Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using SetFocus() While On A PageFrame Doesn't Work.
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Using SetFocus() While On A PageFrame Doesn't Work.
Miscellaneous
Thread ID:
00102337
Message ID:
00102337
Views:
53
Is there any way to get around the fact that issuing SetFocus() in a method doesn't work if the current focus is on a pageframe? If I issue setfocus from the command window it works fine, but from within code it does nothing. I've tried every workaround I know and just can't get it to work. The bit of code that got me pulling my hair is Codebook's SetFocusToFirst():

FOR lnTabIndex = 1 TO this.ControlCount
.FOR lnControl = 1 TO this.ControlCount
..IF UPPER(this.Controls(lnControl).BaseClass) == "TEXTBOX" AND ;
.....TYPE("this.Controls(lnControl).TabIndex") <> "U" AND ;
.....PEMSTATUS(this.Controls(lnControl), "SetFocus", 5)
...IF this.Controls(lnControl).TabIndex = lnTabIndex AND ;
.......this.Controls(lnControl).Enabled
.....this.Controls(lnControl).SetFocus()
.....llRetVal = .T.
.....EXIT
...ENDIF
..ENDIF
.ENDFOR
.IF llRetVal
..EXIT
.ENDIF
ENDFOR


I've stepped through the code and have seen that a particular textbox is getting the SetFocus(), but it isn't working. I've even tried issuing multiple SetFocus() without results. The focus stays firmly seated on the pageframe.

Michael G. Emmons
memmons@nc.rr.com
Next
Reply
Map
View

Click here to load this message in the networking platform