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:
00011065
Views:
30
>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?

The Debug tools can cause problems because they can gain focus while the object of interest loses focus (lost focus methods can fire). Remember if you want to completely control the action of a button (for example) you must 'kill' it's default behaviour. This is done with the NODEFAULT clause.

Tom
Tom
--------------------------------
Tom O'Hare
407-299-4268 -- tom@redtile.com -- http://www.redtile.com/
Independent Programmer Using Visual FoxPro, Visual Basic & more...
Operations Manager -- Virtual FoxPro User Group (VFUG)
http://www.vfug.org/ -- tom@vfug.org
President -- Central Florida FoxPro User Group (CFFUG)
http://www.redtile.com/foxpro/
Universal Thread Most Valued Professional (MVP)
http://www.transformation.com/foxpro/
Previous
Reply
Map
View

Click here to load this message in the networking platform