Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to determine what 1st control on a page is or tabord
Message
 
À
13/05/2004 13:23:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00903578
Message ID:
00903720
Vues:
12
This message has been marked as the solution to the initial question of the thread.
You cannot write the methods at runtime, but you always can extend them different ways.
You can do this with EXECSCRIPT(), or build and compile a prg on the fly.

In this particular case I think you can just get away with writing something like this in every Page.Click() at design time:
* whatever in the click code
DODEFAULT
LOCAL loControl
loControl = EVAL(thisform.page1top)
* You can wrap the previous line in TRY... CATCH just to make sure that  
* thisform.page1top refers to a valid control
loControl.SetFocus()
>Ok, thanks so much. I now have a form property for each page that has the first control of the page in it. However, when I try to modify the click event of the form in runtime (see below) I return an error. How to modify the click of a page during runtime?
>
>
>IF TYPE('thisform.pageframe1')<>"U"
>  ipage = 0
>  mvalue=''
>  FOR EACH loPage IN THISFORM.PAGEFRAME1.PAGES
>    ipage = ipage + 1
>    lnorder = loPage.CONTROLCOUNT
>    FOR EACH oControl IN loPage.CONTROLS
>      IF TYPE('oControl.tabstop')="L" .AND. oControl.TABSTOP = .T.
>	 IF oControl.TABINDEX < lnorder
>	    lnorder = oControl.TABINDEX
>	    *** [Nick's change]
>	    lcFullControlName = SYS(1272, oControl)
>	    lccommand = 'THISFORM.Page' + TRANSFORM(ipage) + 'top = thisform.GetHierarchy(lcFullControlName)'
>	    *** [/Nick's change]
>	    &lccommand
>	    *Example thisform.page1top='TEXT1' && first control on page1
>	ENDIF
>      ENDIF
>    ENDFOR && oControl
>    lccommand = 'mvalue=thisform.page'+ALLTRIM(STR(ipage))+'top'
>    &lccommand
>    *--HERE is my problem, when I try to modify the click method of the page
>    *--it returns the error shown below
>    IF TYPE('mvalue')="C" .and. !EMPTY(mvalue)
>	*Next Line returns error: CLICK is a method, event or object
>	loPage.click = lopage.click+CHR(13)+"DODEFAULT"+CHR(13)+mvalue+".setfocus()"
>    ENDIF
>  ENDFOR  && Page
>ENDIF
>
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform