Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems with SetFocus
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00052740
Message ID:
00052848
Views:
33
>>Hello guys, I know that in 5.0 I can not call SetFocus
>>from within a "When","Valid" or some other methods, but
>>I am calling setfocus from the click event of a button
>>and I am having the same error:
>>"SetFocus can not be called from When,Valid..."
>>Is there any other condition that I am missing ?
>
>Luis,
>
>Just a reminder that you cannot use .SetFocus to restore focus to the object in its .LostFocus event, or in any other event if the object already has the focus.
>
>George

Thanks George, I think that is my problem, but I can't find a
solution to it. This is exactly the scenario :
.- In the click event of my "Add" txtbtns I have

THISFORM.FirstObject.Setfocus()

it works fine when I click in the button, but from the valid
event of THISFORM.FirstObject I have to call a method,
that method perform a TABLEREVERT(.T.) and call
the click event of "Add" again, at this point is when I receive
the error. I was trying to find out if FirstObject already has
the focus before doing the setFocus and it did not work. I use
something like this:

IF NOT THISFORM.ActiveObject.Name="FirstObject"
THISFORM.FirstObject.SetFocus()
ENDIF

But then I receive the error "ActiveObject is not an object",
the weird thing is that if I suspend the program after I receive
the Setfocus error, I can say from the command line
?THISFORM.ActiveObject.name
and I get "FirstObject"

Any suggestions on that ?
Thanks again.
Luis Guzman, MCP
"The only glory most of us have to hope for
is the glory of being normal." Katherine Fulleton Gerould
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform