X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 15 Nov 2006 12:22 PM by  anon
question about exiting
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
15 Nov 2006 12:22 PM
    This question has to do with a project that I inherited from another worker that is no longer here (so I am still learning about the code). In the main Window of the application, in the upper right hand corner are the standard Minimize, Maximize, and Exit (X) buttons. Is there a way to take control of the Exit button so that when a user clicks on it I control what happens to the program? Thank you.

    Deleted User



    New Member


    Posts:
    New Member


    --
    15 Nov 2006 12:22 PM
    The top-level base dialog that presents the Minimize/Maximize/Exit buttons is created with an IDL function called WIDGET_BASE. This function has a keyword syntax option "/TLB_KILL_REQUEST_EVENTS", which makes sure that your application is registered by the operating system to receive the event of a user pressing on the title bar's exit buttons. (By default such an event would bypass your application and go straight to the Operating System.) When the event is sent to your application, your application's event handle for the top-level base can implement code like the following: PRO my_app_event, event if tag_names(event, /STRUCTURE_NAME) eq 'WIDGET_KILL_REQUEST' then begin DO_SOME_LAST_MINUTE_PROCESSING, arg1, arg2 widget_control, event.top, /DESTROY endif END It is up to you to run that last line "widget_control, event.top, /DESTROY" at some point. Once your app has registered to intercept the "kill request message" from the user, the O.S. will no longer get that message, and will no longer know to close the app unless YOUR code explicitly tells it to do so. James Jones
    You are not authorized to post a reply.