* 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 >