Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Form.Closable
Message
From
04/08/1999 22:39:18
 
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00249986
Message ID:
00250050
Views:
17
Hi Dan,

>Can you run code when the user clicks on the Close button (the X) when Form.Closable = .t. I want the close button to function like my Cancel button, which runs some exit code and releases the form. Can this be done with the close button, or do I have to settle for setting Form.Closable = .f. and rely solely on my Cancel button?

If you put:

Thisform.Release

In your Cancel Button, the Destroy Event get called if you close using the cancel button or the (X) up there. How ever this code will also be executed when you hit an OK button that releases the form as well, my suggestion, create a from property lOkClicked. Then in your OK button do:
Thisform.lOkClicked=.t.
Thisform.Release
Then in your destroy event check the status of lOkClicked and run your code accordingly.

If you want the ability to halt closing, use the QueryUnload instaed of Detroy method like Fred Suggested, but in your command buttons you will have to add:
if Thisform.QueryUnload
  Thisform.release()
endif
Previous
Reply
Map
View

Click here to load this message in the networking platform