MapInfo Pro Developers User Group

Expand all | Collapse all

MapBasic EndHandler routine not being called before MapInfo routine

  • 1.  MapBasic EndHandler routine not being called before MapInfo routine

    Posted 02-27-2019 04:11
    Hi,
    I have an endhandler routine that checks to see if a table has unsaved edits. But when closing MapInfo, the endhandler is not called until after MapInfo has already issued a warning of unsaved edits.

    Would it be possible to ensure all running MapBasic routines are terminated (so activate their endhandler routines) prior to running MapInfo's own end handler routines.

    The only way I can overcome this is to add our own exit button within our application, but users don't always wish to close MapInfo that way.

    thanks
    David

    ------------------------------
    David Wilson
    Buchanan Computing
    London, UK
    ------------------------------


  • 2.  RE: MapBasic EndHandler routine not being called before MapInfo routine

    Pitney Bowes
    Posted 03-04-2019 19:26
    Hi David,

    We are looking into this and will get back to you soon.​

    ------------------------------
    Bob Fortin
    Software Architect and Distinguished Engineer
    ------------------------------



  • 3.  RE: MapBasic EndHandler routine not being called before MapInfo routine

    Pitney Bowes
    Posted 03-05-2019 03:24

    Hi David,

    You can use the MapInfoProExiting event to replicate the behavior you need for your application. This event is raised before MapInfo's own end handler is called and therefore you can execute your code in the handler of this event.


    I have attached a sample mapbasic code where you can see how to implement the MapInfoProExiting  event. Search for MapInfoProExiting in the code.
    Thanks
    Anshul



    ------------------------------
    Anshul Goel
    Knowledge Community Shared Account
    ------------------------------



  • 4.  RE: MapBasic EndHandler routine not being called before MapInfo routine

    Posted 03-05-2019 03:44
    Hi Anshul,

    That sounds promising, I hadn't come across that before, but I couldn't see any attachment in the email or posting.

    I presume this is not a standard MapBasic handler as it's not mentioned in the MapBasic help.

    Cheers

    David

    ------------------------------
    David Wilson
    Buchanan Computing
    London, UK
    ------------------------------



  • 5.  RE: MapBasic EndHandler routine not being called before MapInfo routine

    Pitney Bowes
    Posted 03-05-2019 04:07
      |   view attached

    Hello David,

    I have attached the file again. This event is not part of standard MapBasic, it was introduced in 64 bit MapInfo Pro as part of extensibility framework.

    You can check its documentation in Extensibility reference.

    Thanks

    Anshul



    ------------------------------
    Anshul Goel
    Knowledge Community Shared Account
    ------------------------------

    Attachment(s)

    zip
    Ribbon.zip   3K 1 version


  • 6.  RE: MapBasic EndHandler routine not being called before MapInfo routine

    Posted 03-06-2019 04:01
    David,

    If you still are using the RIBBONLib in your tools, you can use this function to register the event:
    Function RBNEventSubscribe(   ByVal nEventType As IntegerRBNEventSubscribe(   ByVal nEventType As Integer , ByVal sMBXHandler As String )

    You basically pass the event type to subscribe to and the procedure you want to get called when the event is raised

    ------------------------------
    Peter Horsbøll Møller
    Pitney Bowes
    ------------------------------



  • 7.  RE: MapBasic EndHandler routine not being called before MapInfo routine

    Posted 03-06-2019 05:58
    Thanks Anshul and Peter
    I had actually made use of the code from Anshul before looking into the Ribbonlib.
    I certainly helps tidy up the closure of the applications.

    ------------------------------
    David Wilson
    Buchanan Computing
    London, UK
    ------------------------------