Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
On Valid() i want known if I am abandoning the activefor
Message
From
14/11/2003 10:16:07
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
13/11/2003 09:00:01
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00849478
Message ID:
00849880
Views:
25
>Hi,
>
>i have found a bug on VFP.
>
>When this bug occur, i can, with activeform.ActiveControl.Valid() return .F./0, abandoning the activeForm and go to another form, then return to the form and go to another control.
>
>Somebody known a way to known at activeform.ActiveControl.Valid() time if i'm abandoning the active form ? If exists, i can found a workaround for the master problem ( violation of valid rule ).

You can put some code in the form's .deactivate method, something like this:
if not isnull(this.activecontrol)
   this.lValidated=this.activecontrol.valid()
   if not this.lvalidated
      this.lastActiveControl=this.activecontrol
   else
      this.lastActiveControl=null
   endif
else
   this.lvalidated=.t.
   this.lastActiveControl=null
endif
Then in the .activate
if not isnull(this.lastactivecontrol)
   this.lastactivecontrol.setfocus
endif
Of course, this would need a little more checking, making sure the lastactivecontrol is null initially. You may also have problems if form.deactivate happens during a valid() (could create a loop if you don't check for that), or some other problems (messagebox(), popping up any child form), but these can be worked around.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform