Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Performing check for unsave info before quiting
Message
De
23/03/1999 00:17:18
 
 
À
23/03/1999 00:08:24
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00200794
Message ID:
00200797
Vues:
8
>How do I perform a check for unsave information b4 closing the application. This is important especially for users who like to close the application by clicking the "X" on the right top corner. Let's say that I still have a few forms opened in my application, and I need to close them , asking for Saving confirmation b4 quiting the main application.
>
>Thanks.

Any form's QueryUnload event has the power to stop the form from closing when the user clicks on the 'X'. When the user tries to close the top-level form or the VFP window by clicking on the 'x' VFP first tries to close all of the child windows. If any fail, the app will not close. To keep a form, and subsequently the app, from closing, issue a NODEFAULT in the form's queryunload event.

Form.QueryUnload:
IF THISFORM.SomethingChanged = .T.
    lnAnswer = MESSAGEBOX('Do you want to save your changes?', 3+32)
    DO CASE
        CASE lnANswer = 6 && Yes, save the changes
            TABLEUPDATE(.T.,.T.)
        CASE lnANswer = 7 && No, don't save
            TABLEREVERT(.T.)
        CASE lnANswer = 2  && Never mind, I don't want to close the form
            NODEFAULT
    ENDCASE
ENDIF
Erik Moore
Clientelligence
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform