Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Don't close the form
Message
De
27/03/2007 15:17:11
 
 
À
27/03/2007 15:14:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01208976
Message ID:
01208978
Vues:
19
This message has been marked as the solution to the initial question of the thread.
>I have a form. On the form is a Pageframe with two pages. Each page has a ADD/SAVE button and a DONE/CANCEL button.
>
>If the use presses the "X" button, I want to validate that there are no unsaved changes.
>
>I've put the following code in various methods
>NODEFAULT
>WITH thisform.pageframe1
>   IF .pages(.activepage).cmdAdd_Save.caption = "Save"
>	=MESSAGEBOX("You have unsaved changes"+CHR(10)+"Please press <Save> or <Cancel>")
>	RETURN .F.
>   ELSE
>	DODEFAULT()
>   ENDIF
>ENDWITH
>
>When I put this in the Form Release method the code didn't fire when I clicked the X.
>
>When I put this in the Form Unload method, the pageframe had already been unloaded and an error was generated.
>
>When I put this in the Destroy method, the messagebox popped up, but the form closed anyway.
>
>Similar syntax works correctly in the page Deactivate event.
>
>I could really use some advice on the correct event to code and the proper syntax to make this work the way I would like.
>
>Thanks to all.........Rich

Validation code should go to Form.QueryUnload event.
Edward Pikman
Independent Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform