Information générale
Catégorie:
Gestionnaire d'écran & Écrans
>>I understand now why I can't reference my form, but I'm pretty confused. The variable used to reference the form is scoped to the calling event. Right? so as soon as the event is over the variable goes away. What I'm confused about is how I am supposed to handle this. Do I make the variable public before calling the form? IE:
>>
>>PUBLIC myForm
>>DO FORM myForm.scx
>
>No, like this:
>
>DO FORM myForm NAME oMyForm
>
>Now, forms launched from this form can refer to it as
>
>oMyForm.Something
This won't work if myForm is modeless. Let's say the code: DO FORM myForm NAME oMyForm is in the click event of a command button. The variable oMyForm is scoped to the click event. Because the form is modeless, the click event finishes and the variable is no longer accessible. Here is an example:
create 2 modeless forms, form1 has a command button with the following code: DO FORM form2 NAME oForm2 LINKED. When you run form1 and click on the button, form2 will come up and immediately close, because the variable oForm2 goes out of scope almost immediately. If form2 is made modal, then the code stops executing in the click event leaving the variable in scope, and therefore accessible.
Thanks,
Marcus.
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