Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Don't close the form
Message
From
27/03/2007 16:00:31
 
 
To
27/03/2007 15:17:11
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01208976
Message ID:
01208993
Views:
16
>>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.

Thank you very much. One extra question if I may......

This now works......but have I "properly" coded NODEFAULT and DODEFAULT()???

Thanks again
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform