Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with SetFocus method!
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00011060
Message ID:
00011119
Views:
31
Hi Shane,

>I have a form with two textboxes (Text1 & Text2) and two commandbuttons (Command1 & Command2). Set the tab order to the following: Command1, Text1, Command2, Text2. Set the enabled property for Text2 and Command2 to .F.. I have the following code in the Click event of Command1:
> THISFORM.Text2.Enabled = .T.
> THISFORM.Text1.Enabled = .F.
> THISFORM.Command2.Enabled = .T.
> THISFORM.Command1.Enabled = .F.
> THISFORM.Text2.SetFocus()
>
>When I run this form and press the Command1 button the focus jumps to the command2 button. However, when I step through the code in the trace window it seems to work ok.
>
>Any ideas?

It's because u're disabling Command1 button. If u comment
the THISFORM.Command1.Enabled = .F. line it will work fine.
I guess this is a bug, but i don't know if it is documented
in the MS knowledge base. Also i don't remember an easy
work around :(.
Even disabling the Command1 buttom from the text2 getfocus()
event will not work. Just in case u want to dispair more :)

Ciao,

J. Luis
J. Luis Santiago Rodríguez.• CADIS • E-mail: jlsantiago@iserve.net.mx• Ciudad de México.
Previous
Reply
Map
View

Click here to load this message in the networking platform