Mensaje
De
04/12/2006 13:30:30
Donald Lowrey
Data Technology Corporation
Las Vegas, Nevada, United States
 
 
a
02/12/2006 16:36:30
Donald Lowrey
Data Technology Corporation
Las Vegas, Nevada, United States
General information
Foro:
Visual FoxPro
Category:
Automatización COM/DCOM y OLE
Miscellaneous
ID de la conversación:
01174404
ID del mensaje:
01174675
Views:
12
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
Previous
Responder
Mapa
Ver