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
_______________________________________________
Post Messages to: ProFox@leafe.com
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/20130131004803.DGLC2487.priv-edmwes24.telusplanet.net@edmwcm02
** 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.
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: ProFox@leafe.com
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/5109C306.5050803@gmail.com
** 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.
Hi Gene,
it's the way it works : you can not 'interrupt' the execution of a method or
event. When you execute CLEAR EVENTS, the 'event' is just added at the top of
the event stack ... and unstacked at the end of the current method ....
You have a 'if' to test if the app must end, put the rest of the method in the
'else' ... Hope I am clear.
Now instaed of SYS(1270), can try just to write : thisform.object_name (ie
Thisfom.btnquit). I think it will work. If yes, it shows that the gotfocus() of
the next object is fired before the lostfocus of the current object ...
HTH
The Foxil
_______________________________________________
Post Messages to: ProFox@leafe.com
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/510A25D9.1090301@wanadoo.fr
** 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.
At 17:04 2013-01-30, Frank Cazabon <frank.cazabon@gmail.com> wrote:
>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.
I do not have anything else but the form needing event
handling. If I do not clear events in the form, then the program
just sits there waiting for events. (In my app, I have a menu and
the clear events is in there on the Exit selection.)
>It sounds like you want your exit button to act like a cancel button.
Well, no. I want some buttons to not trigger validation. Exit
is but one of them. Cancel (if the documentation is correct) only
allows for one such button.
I also want a Reset button which will exit the adding/editing
of a row but still have the form active. (Most of my forms do not
call up rows on entry. One has to specify form actions (Add, Edit,
Delete, OK, Reset, Exit) with each of these buttons enabled/disabled
depending on state. (For example, when Adding, Add, Edit, and Delete
are disabled and OK, Reset, and Exit are enabled.)
>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.
[snip]
Sincerely,
Gene Wirchenko
_______________________________________________
Post Messages to: ProFox@leafe.com
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/20130131171437.CWGC5280.priv-edmwes50.telusplanet.net@edmwcm02
** 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.
At 00:05 2013-01-31, Jean MAURICE <jsm.maurice@wanadoo.fr> wrote:
>it's the way it works : you can not 'interrupt' the execution of a
>method or event. When you execute CLEAR EVENTS, the 'event' is just
>added at the top of
Of course you can. A return statement does that. The way that
clear events is documented, it supposedly works the same way but
return to after the read events statement ...
>the event stack ... and unstacked at the end of the current method ....
... but as I have found, it works as you stated.
>You have a 'if' to test if the app must end, put the rest of the
>method in the 'else' ... Hope I am clear.
>
>Now instaed of SYS(1270), can try just to write :
>thisform.object_name (ie Thisfom.btnquit). I think it will work. If
>yes, it shows that the gotfocus() of the next object is fired before
>the lostfocus of the current object ...
Going your way, I wonder if I can put a check in the next
object, say an Exit button, to bypass the validation somehow. Set a
form-level property on whether to do validations to false in GotFocus
or When and check the property before each validation. This seems
messier than what I have worked out.
With my solution, the mess is in the data entry objects'
LostFocus and serves the purpose of bypassing the validation. I much
prefer to have the handling all in one place.
Sincerely,
Gene Wirchenko
_______________________________________________
Post Messages to: ProFox@leafe.com
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/20130131172334.GDRM1732.priv-edtnes25.telusplanet.net@edtncm02
** 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.
On 01/31/13 09:14 AM, Gene Wirchenko wrote:
>
>> It sounds like you want your exit button to act like a cancel button.
>
> Well, no. I want some buttons to not trigger validation. Exit is
> but one of them. Cancel (if the documentation is correct) only allows
> for one such button.
Hi, Gene. Good to hear another voice from the past! Are you still in
the Great White North?
I'm not sure I understand the problem you're having with LostFocus(),
having to check which control the mouse is in. Are you using the
LostFocus() for the specific control, or are you using the one for the
form itself? We've never touched the form's LostFocus().
I try to use Valid() as much of the time as possible, but there are
situations when validation may require another form to pick a valid
value, and we fell over the rule that you can't have two Valid() events
on the stack. So we moved those to LostFocus() and all works pretty well.
Dan Covill
_______________________________________________
Post Messages to: ProFox@leafe.com
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/510AAF39.7050400@san.rr.com
** 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.
At 09:51 2013-01-31, Dan Covill <dcovill@san.rr.com> wrote:
>On 01/31/13 09:14 AM, Gene Wirchenko wrote:
>>
>>>It sounds like you want your exit button to act like a cancel button.
>>
>> Well, no. I want some buttons to not trigger validation. Exit is
>>but one of them. Cancel (if the documentation is correct) only allows
>>for one such button.
>
>Hi, Gene. Good to hear another voice from the past! Are you still
>in the Great White North?
Yes. Kamloops, British Columbia, Canada.
USENET is pretty much dead for the Fox groups that I was
following so I cast about for a Fox discussion group and remembered
ProFox. I dropped ProFox several years ago because of all of the OT
postings. I had gone to the lite version, but the OT posters did not
follow the [OT] convention and Ed did not rein them in. A bit of OT
is not that much of a deal, but the amount then was drowning out the
Fox traffic. I am pleased to see that it is better now.
>I'm not sure I understand the problem you're having with
>LostFocus(), having to check which control the mouse is in. Are you
>using the LostFocus() for the specific control, or are you using the
>one for the form itself? We've never touched the form's LostFocus().
Controls.
Why am I checking which control? It is like this:
The user decides to exit (or some other action that should
bypass validation). (If you want to exit a form without saving, it
should not matter whether the value in the current control is valid.)
The user clicks on the, say, Exit button.
Among other things, the data control's LostFocus fires. There,
I check for where the mouse pointer is -- Is it on a bypassing
control? -- and whether the mouse button is down -- Has the button
been pressed? -- and if both are so, I exit the form (or whatever is
required) without having to bother with the validation.
>I try to use Valid() as much of the time as possible, but there are
>situations when validation may require another form to pick a valid
>value, and we fell over the rule that you can't have two Valid()
>events on the stack. So we moved those to LostFocus() and all works
>pretty well.
That rule is why I am considering switching. I have places
where I do not have control-level validation because of that
rule. Why was it changed to that way anyway? (My understanding is
that VFP 3 did not have it and 5 did.)
Sincerely,
Gene Wirchenko
_______________________________________________
Post Messages to: ProFox@leafe.com
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/20130131180756.TQKC12851.priv-edmwes26.telusplanet.net@edmwcm02
** 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.