Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there any way to UnFocus()?
Message
From
08/07/2003 16:39:28
 
 
To
08/07/2003 16:04:30
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00808129
Message ID:
00808229
Views:
12
Steve,

You have a good point.
It overlooks something though: nextcontrol.enabled might be .f. when I need it. Also, if nextcontrol.TabIndex > this.TabIndex + 1, then there are controls between them that might get enabled between the 1st and 2nd time I need it.

But it would be worth while to store the nextcontrol the first time I determine it and then test to see if it's still enabled and visible the next time I need it. And if it isn't loop through again. I would also test to verify that nextcontrol.TabIndex = this.TabIndex+1 and if not loop through again.

Thanks


>Bill,
>
>Rather than looping through the controls every time, it would be more efficient to do it one time...at init() of the form. You probably can't do it at the init() of the class because all of the other controls (probably) have not fully initialized yet.
>
>Anyway, loop through the controls and store an object reference to the next control in a custom property of the container (I called it nextControl).
>
>Then, to actually setfocus(), all you do is something like the following from inside the container:
>
>
>this.nextControl.setfocus()
>
>
>However, since this type of container may only exist once per form, and you know what the next control is at design time, it might be just as easy to manually store the object reference in the form's init(), for example:
>
>
>thisform.container1.nextControl = thisform.text9
>
>
>>Hi Pamela,
>>That's pretty much how I did it. Just have to check for loControl having a TabIndex (BaseClass custom doesn't have a TabIndex) and Enabled and Visible. Also have to check if This.TabIndex is the last one in This.Parent.Controls so you can set it to the 1st on in Parent.
Bill Morris
Previous
Reply
Map
View

Click here to load this message in the networking platform