Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to find out the control focus is jumping to?
Message
From
18/12/2008 18:52:27
 
 
To
18/12/2008 13:18:28
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01368256
Message ID:
01368711
Views:
9
>>If I were to do it as you have suggested, that means I will have to add code to GetFocus event of almost all controls in the form and I think I can easily forget about adding the same code, if in the future I need to add new control to the form.
>
>In the init of the form, you can build an array property, which would hold a reference to all of the controls which can get focus, and their tab order, sorted by 2nd column. The reference may be just names, and not even recursive if you don't need it to - containers are a single focus unit anyway. Then you can have a method called NextInTabOrder(toAfterThisControl), which would find your current control's row in the array, and return a reference to the next control.
>
>Note: if you build references in the array via sys(1272), the form's name isn't what you'd expect until form's .init() exits - it's the classname or something equally generic; only after the init, when the object formally exists, it gets its .name property set. When referencing objects via their sys(1272) string, replace the first segment with "thisform".
>
>Note2: if you keep references as object references, take care to null them all in the cleanup. Automatic cleanup may work, but once it doesn't, you'll be too busy with something else.

But I was initially looking for a way to determine where focus is heading (inside LostFocus event), I mean it could be cause by a mouse click that jump the focus to any control from the current one, which means it has nothing to do with tab order.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform