Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setfocus...... is not
Message
From
20/10/2000 14:56:09
Cindy Winegarden
Duke University Medical Center
Durham, North Carolina, United States
 
 
To
20/10/2000 14:13:56
Tom Gahagan
Alliance Computer Solutions
Thomaston, Georgia, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00432176
Message ID:
00432221
Views:
27
Tom,

I made a form with a button and a pageframe like you describe. In the GotFocus() I put a wait window and the Text2 did actually get the focus. If I started typing after that my typing appeared in the textbox.

I think what you want is for focus to be on your Text2 control and for processing to stop there and READ EVENTS to take over. When this is the case the cursor will blink in Text2, which it did not when the SetFocus() was called from inside an IF statement.

Someone may have a more elegant way but the following works:
LOCAL lcSetFocus
IF ...
    lcSetFocus = [Text2]
ELSE
    lcSetFocus = ...
ELSE

*!* Second "." is where the macro expansion stops
ThisForm.PageFrame1.Page1.&lcSetFocus..SetFocus()
If you're not setting focus in the ELSE part of the statement, you could use
LOCAL lcSetFocus
IF ...
    lcSetFocus = [ThisForm.PageFrame1.Page1.Text1.SetFocus()]
ELSE
    lcSetFocus = []  && Do nothing
ELSE

&lcSetFocus
>I'm having trouble with a setfocus not working.
>
>In a command button click event I have this code.....
>
>if m_occ = 0
>??chr(7)
>messagebox('Path information missing!',48,'Notice')
>thisform.pageframe1.page1.text2.setfocus
>else
>blah
>balh
>endif
>
>When m_occ = 0 the messagebox comes up fine but the setfocus does not work and the code continues after the endif.
>
>The command button and text box are on the same page. (page1)
>The textbox is visible and enabled.
>
>I tried commenting out the messagebox thinking that might be it but it still did not work.
>
>I also tried
>
>thisform.pageframe1.page1.setfocus
>thisform.pageframe1.page1.text2.setfocus
>
>and is still does not work.
>
>I know that you can not use setfocus in a valid but why is it not working in a click event of a command button?
>
>TIA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform