Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Activecontrol
Message
 
 
To
14/07/2001 03:47:42
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00530617
Message ID:
00530670
Views:
16
>How can I know which control is in the focus at present? I tried with Activecontrol but somehow clould not get it.
>
>Regards to all.

Suppose, you want to restore focus on control, which had focus before, after you click on some button.

Add a new property to your form, say, oLastFocus (this would hold the object reference to the object, which currently has focus). Assign null to it in property sheet.

In button when event:
if type('thisform.ActiveControl')='O'
   thisform.oLastFocus=thisform.ActiveControl
else
   thisform.oLastFocus=null
endif
In button click:
 Do your usual code
      if not isnull(thisform.oLastFocus)
         thisform.oLastFocus.SetFocus()
      endif
In form destroy event add
thisform.oLastFocus=null
Everything is off the top of my head and not tested, so you can take it as an idea.

Hope this helps.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform