How to Catch the [X]

Discussion in 'Questions (Windows Mobile)' started by Cableguy, May 21, 2007.

  1. Cableguy

    Cableguy Expert Licensed User

    Hi,

    I think I saw a post about this in the old forum, how can we catch the [X] press event?

    I know this sounds stupid....heres my code..

    What happens is that it seems to be a circular call(!?), What i'm trying to acomplish is that wether thru the "exit" menu item, wether thru the [X] button, the user is questioned if the "inplay" var is true.
    What am I doing wrong?
     
    Last edited: May 21, 2007
  2. Erel

    Erel Administrator Staff Member Licensed User

    AppClose closes the main form.
    This is the right code:
    Code:
    Sub Exxit_Click 'exxit is a workaround for the exit menuitem
     AppClose
    End Sub

    Sub Main_Close
      
    If inplay=true then
     
    if msgbox("Do you really wish to Exit?""Exit Pairs v2.0", cMsgboxYesNo, cMsgboxQuestion) = cNo then
      Main.CancelClose
    End If
    End If
    End Sub
     
  3. Cableguy

    Cableguy Expert Licensed User

    I understand your code, but where is the error in my code, my logic is only in the wrong way, but still true isn't it?
    As I understand Applose calls the form_close event/sub? and if not present it close the form...Wright?
     
    Last edited: May 21, 2007
  4. Erel

    Erel Administrator Staff Member Licensed User

    Calling AppClose calls Main_Close which calls again AppClose... until you get a stack overflow.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice