Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Valid Event does not fire when I click outside of the ob
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00119392
Message ID:
00140070
Views:
31
>Brenda,

>Finding a generic way of addressing the activecontrol when pageframes and grids are involved without using a framework that already knows the activecontrol is not a pretty sight.

>Your best bet is to use a form class where you can add a method to do this for you. Then from your toolbar or menu you can _screen.activeForm.UpdateBuffers() or whatever name you give the method.

>In that method you would need to read the currently active control and determine if it is a page or a grid or what and appropriately deal with it. The form class that I have uses a property of the form named LastControl. Every control's GotFocus sets a self reference to THISFORM.LastControl and the form's Destroy sets LastControl to NULL. So all I have to do in a toolbar is oApp.oForm.LastControl.SetFocus(). oApp is the application object, oForm is a property of teh application object that holds a reference to the current form. All fomrs are run by calling oApp.LaunchForm so that app can track teh forms. Every form reports in to oApp on Activate, Deactivate, and destroy.

jim,

tryed implimenting this, having some success, but also having some problems.

1. when you say "every control's gotfocus sets a self reference to thisform.lastcontrol". i am saying whatever.lastcontrol = "whatever.txtlastname". is there a easier way to set a self reference than typing the name in for each control?

2. when the client clicks on toolbar.cmdsave, and i setfocus, yes the valid is fired, and the messagebox comes up if an error is found. but how can i in otoolbar.cmdsave know that? i do not want to continue with the save if an error was found. know i can set a global variable, but is there a better way?

3. have not decided if i will setfocus at the toolbar or at the page. but either way i am having trouble with the setfocus syntax. my lastcontrol currently (unless i/you/we come up with a better way) has the "whatever.text1" reference. when i try to "this.lastcontrol.setfocs()", or "this.&lastcontrol..setfocus()" it doesnot work. can not get the syntax right.

thanks, brenda
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform