Information générale
Catégorie:
Codage, syntaxe et commandes
Titre:
Referencing a class in a form from another class
I have a class that is made up of a container and some labels. We will call it Example1.
I instantiate this class with oExample1 = CREATEOBJECT("example1") at the beginning of my program. I then run a form with DO FORM. In the ini() method of the form, I ADDOBJECT("oExample1", "example1") this container class to the form.
While the program is running, a timer object fires a method in another class that was also instantiated at the beginning of the program with oExample2 = CREATEOBJECT("Example2"). While this method is running, it updates the captions in the first class with oExample1.lblLabel.Caption = Testing". This update is not reflected in the Example1 class.
My thought is that I have create two separate instances of Example1, so changeing the labels in oExample does not effect frmForm.oExample. If this is true, how do I go about writing to the object in the form from outside the form. I have tried _SCREEN.frmForm.oExample, frmForm.oExample, and _VFP.frmForm.oExample to no avail. The other question would be, am I going about this the wrong way?
Thanks Ed
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