Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using SetFocus() While On A PageFrame Doesn't Work.
Message
De
27/05/1998 09:35:31
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00102337
Message ID:
00102341
Vues:
30
>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.

If you want to set focus on control which is part of currently inactive page then you should firstly activate this page:
Thisform.Pageframe.ActivePage=Thisform.Pageframe.PageX.PageOrder
and now you can set focus:
Thisform.Pageframe.PageX.ControlX.Setfocus
Edward Pikman
Independent Consultant
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform