Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Resetting focus
Message
 
To
24/09/1998 17:41:20
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00140552
Message ID:
00140625
Views:
25
I'm assuming you're (a) MYVARIABLE is a public variable since it would go out of scope otherwise, and (b) really meant SetFocus, not GetFocus in the code you posted.

Instead of using a public variable (public variables are generally considered bad practice), add a custom property to the form to hold the object reference (oLastObject for example).

In the when of your button, set the reference using:
ThisForm.oLastObj = ThisForm.ActiveControl
In the click of the button:
Insert Your Code to Replace Values here
ThisForm.oLastObj.SetFocus()
And finally, in the QueryUnload:
*Clear the object reference so the form can be released
thisform.oLastObj = .NULL.
return .t.
>A better description of the problem:
>The textbox has focus...
>I have STORE THIS.MYNAME (MYNAME is the object name of the textbox)
>TO MYVARIABLE in the textbox gotfocus code...
>The user clicks a button with the click event code THISFORM.MYVARIABLE.GOTFOCUS to return focus to the textbox, but the textbox does not receive focus.
>I also tried THISFORM.&MYVARIABLE.GOTFOCUS
kenweber
GCom2 Solutions
Microsoft Certified Professional

Previous
Next
Reply
Map
View

Click here to load this message in the networking platform