Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to determine whether a textbox is having focus?
Message
From
21/12/2010 04:16:58
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
21/12/2010 01:52:43
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01493326
Message ID:
01493440
Views:
61
>>Though it's possible that nothing has control at the time, i.e. thisform.activecontrol may be null, so some checking needs to be done.
>
>What if I add a property say lHasFocus, then set its value each time when the event GotFocus and LostFocus are triggered...
>will I still miss anything?

The framework I use has that, so I guess it's been tried already. Why not. I've also seen frameworks where a form-level method would do all the checking and return a reference to the active object, so you'd have something like

if thisfrom.WhatIsActiveControl()=this

which also worked. As usual, it can be done three ways in Fox, or isn't worth doing :).

It's possible that other code may run while your control still has focus - timer events, grid refreshes, toolbar buttons code, OKL. These don't take focus away.

back to same old

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

Click here to load this message in the networking platform