Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP 5.0 & SetFocus()
Message
From
17/12/1996 13:13:00
Paul Watson
Mcv Global Systems, Inc.
Pasadena, California, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Title:
VFP 5.0 & SetFocus()
Miscellaneous
Thread ID:
00015359
Message ID:
00015359
Views:
112
In VFP 3.0 you could issue a SetFocus() to change the focus to a different prompt. In 5.0, a new error is genterated. Error 2212 - "Cannot call SetFocus from within a When, Valid, RangeHigh or RangeLow event."

I have worked around this for the most part by moving my code from When & Valid events to GotFocus & LostFocus events. I have one problem left. My forms have the Save button on a toolbar. When the user clicks on Save, or on a navigation button, I need to check for changes and see if they want to save them. The problem is that the data entered in the currently active field is not recorded until the active control's Valid event fires. So, my RecordChanged method contains the following code:

* Force the Valid() event for the current prompt...
IF TYPE('ThisForm.ActiveControl') = 'O'
ThisForm.ActiveControl.SetFocus()
ENDIF
cResults = GETFLDSTATE(-1)

How can I force the Valid event for an active control to fire without issuing SetFocus?
Paul Watson
MCV Computer Consultants
MCV Global Systems, Inc.
pWatson@PrimeNet.Com
Next
Reply
Map
View

Click here to load this message in the networking platform