Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is my Class going out of scope - How to fix?
Message
De
04/12/2006 13:30:30
Donald Lowrey
Data Technology Corporation
Las Vegas, Nevada, États-Unis
 
 
À
02/12/2006 16:36:30
Donald Lowrey
Data Technology Corporation
Las Vegas, Nevada, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
01174404
Message ID:
01174675
Vues:
9
I think we've got it.

The problem was in the communication between the timer class and the class that does the work.

Dragon, Rick and Fabio both noted a problem with my global object approach. The light bulb finally went on when I studied the thread that Sergey mentioned.

Thank you all for your insights.

The solution was in making a assignment of the Timer object to a propery of the work class. I had been creating the timer object and then made a direct call to a method of the work class.


******
Define the class that does the work, then Declare a property for that class
loTimer = NULL

Create the timer object, and store a reference to the object in THIS.loTimer. Pass a work class object reference as a parameter to the timer class.

PROCEDURE INIT
THIS.loTimer = CREATEOBJECT("MyTimer",THIS)
* Not this way: oMyTimer = CREATEOBJECT("MyTimer")
ENDPROC

*****
Define the Timer Class, then declare a property in the Timer class
loParent = NULL

PROCEDURE INIT
LPARAMETERS oParent && oParent is the passed in reference to the work class
THIS.loParent = oParent
ENDPROC

* Now we can call a method in the work class
PROCEDURE Timer
This.loParent.Proc1() && Do something in a method of the work class
* Not this way: oWorkClass.Proc1()
ENDPROC
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform