General information
Category:
COM/DCOM and OLE Automation
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
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only