Gene,

you should really only have one READ EVENTS (in your main program and nowhere else) and one CLEAR EVENTS in your application. You shouldn't have to use CLEAR EVENTS to close a form.

It sounds like you want your exit button to act like a cancel button. Set the buttons Cancel property to .T. and then in your validation check for LASTKEY() <> 27. Again, this is off the top of my head as I haven't had to deal with the nitty gritty like this in a long time. Note that pressing the Escape key will now call your exit button's click method.

Frank.

Frank Cazabon

On 30/01/2013 08:47 PM, Gene Wirchenko wrote:
Dear ProFox'ers:

I have LostFocus validation working reasonably well now with a test form though I am sure that more complications will ensue.

I have just found a weird behaviour of clear events. I thought I understood clear events.

In my LostFocus, I start by checking if the mouse pointer is on the Exit button (with sys(1270)) and that the left mouse button is down (with mdown()). If this is so, I do not want the validation done, but rather, I want to terminate the form. I use clear events for this.

My understanding was that execution goes to the statement immediately after the read events. The VFP 9 docs support this, stating, "Stops event processing started with READ EVENTS. When CLEAR EVENTS is executed, program execution continues on the program line immediately following READ EVENTS."

This is not what happens. The method executing continues to execute, and when it finishes, then the clear events takes effect (as best as I can see).

     Am I missing something here?

Sincerely,

Gene Wirchenko


[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to