[reordered to chronological]
At 07:06 2013-04-29, Richard Kaye <[email protected]>
wrote:
Gene Wirchenko:
<snip>
There is another factor. If one has certain events on the execution
stack, one can not use SetFocus. That will throw an error
2012 ("Cannot call SetFocus from within a When, Valid, RangeHigh or
RangeLow event.")
<snip>
You can work around this limitation, in VFP 9 at least, by RETURNing
to the control/object that you want to set focus to like so:
<some code that doesn't pass your validation test but you want to
let the user go somewhere else>
RETURN thisform.myControlToSetfocusTo
This is documented in the VFP 9 help
"In Visual FoxPro 9.0, the SetFocus method is not supported in the
When Event, Valid Event, RangeHigh Event and RangeLow Event events.
However, you can include a RETURN Command with an object name
(RETURN <ObjectName>) in these events to set the focus to another
control. If a RETURN command with an object name is included, the
focus is set to the control specified with <ObjectName>."
But what does that do for the validation on that control? You
have bypassed it with that return, right? What if you still need it?
Sincerely,
Gene Wirchenko
_______________________________________________
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/
** 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.