Information générale
Catégorie:
Gestionnaire d'écran & Écrans
Hi Jim
you wrote...
>How are you addressing the form and from where? Obviously, the form has not gone out of >scope or it wouldn't be there. Your reference to the fomr may have gone out of scope, and to >fix that it would be helpfuul to know the exact code you are using to refer to the form when it >doesn't work (also very impotant to know where that code is in the system).
OK Jim, here's a situation extremely similar to the first.
I like my users to have a keyboard option for every function in the app. I've just given them the option to switch between pages in a pageframe using the alt key plus the relevant page number (so ALT+3 activates page 3 of the pageframe).
To begin with I tried a simple OKL
"on key label 'ALT+1' thisform.pageframe1.page1.activate"
can't do that because "thisform" can only be called within a method.
OK. So we went to
"on key label 'ALT+1' startit.actpage(1)" where 'startit' is my global app (following on from previous guidance you gave me some moons back).
In the 'actpage' method I tried
lparameter pagenum
cform=this.setform() && retrieves the current form name - in this case the formname was 'ordheads'
pageact='page'+alltrim(str(pagenum))
pagedeact='page'+alltrim(str(_screen.activeform.pageframe1.activepage))
dpage=cform+'.pageframe1.'+pagedeact+'.deactivate'
apage=cform+'.pageframe1.activepage='+alltrim(str(pagenum))
&dpage
&apage
This fell over protesting that 'object ordheads not found'
yet in the debugger, '_screen.activeform.name' returns 'ordheads'
the only way I could make it work was to substitute '_screen.activeform' for 'cform'. Which also let me drop a line thus:
lparameter pagenum
pagedeact='page'+alltrim(str(_screen.activeform.pageframe1.activepage))
dpage='_screen.activeform'+'.pageframe1.'+pagedeact+'.deactivate'
apage='_screen.activeform.pageframe1.activepage='+alltrim(str(pagenum))
&dpage
&apage
which works a treat. Of course, someone will no doubt come up with a much simpler and more elegant solution to the problem, which I'd be interested in but I would still want to know why the reference to the current form (which doesn't get hidden, deactivated or lose focus in any way) behaves as though its gone 'out of scope'.
Thanks
Harry
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement