Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Where is the escape controlling the form queryunload?
Message
From
02/12/2003 08:55:17
 
 
To
02/12/2003 02:09:21
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00854871
Message ID:
00854976
Views:
23
Hi Dragan,

I recently stepped through this myself while converting dos screens to VFP8 forms and in my testing clicking on close box in the top right corner of the form set lastkey to 27 also. This worked great for my purposes since I check for the lastkey depending on whether the user pressed escape to exit the form, clicked on the cancel button (which has cancel set to .t.) or clicked on the close box or a close button.

My only issue has always been that queryunload and release are not always called (I had to change my code in buttons to call queryunload and have queryunload return .t. or .f. which is typically determined by whether or not a custom close method ran successfully to determine if release should be called)- it depends on how you exit the form. I think the same events should run regardless (release, queryunload, destroy, unload) of how the form is exited.


>>>An ON ESCAPE handler? You sure there's no code anywhere in the form class hierarchy?
>>
>>I have been trying to find where this is coming from. I've searched for ON ESCAPE as well earlier on tonight. I was not able to find it.
>
>I somehow think that this was once better documented in the help than it is now. It says that if ESC is pressed, a button with .cancel=.t. will receive a click event. Lastkey() will of course be 27.
>
>What I can't find is that it should also work backwards, i.e. a mouse click on such button should also set lastkey() to return 27. I have too many things open at the moment to try this, but I seem to remember that testing for lastkey()=27 was sufficient if there was a cancel button on the form. If the test returned .t., the user initiated close form. Don't remember if QueryUnload was also affected with this, i.e. whether clicking the close box also set lastkey() to 27.
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Reply
Map
View

Click here to load this message in the networking platform