AndrewMozley
Programmer
I have a form myform.scx which I can call from myprog.prg or from an intermediate menu
Myprog.prg also defines a class, clsmyfuncs whose purpose is to contain several useful functions.
So in Scenario 1, myprog.prg looks like this
* Lots of initialisation code
DO myform.scx
DEFINE CLASS clsMyFuncs AS Custom
FUNCTION FmtBigDate
. . .
RETURN Answer
ENDEFINE
This works fine, and within myform.Init() I can say
.zMyFuncs = CREATEOBJECT("clsMyFuncs")
. . .and later on call .zmyfuncs.FmtBigDate()
If however I choose to call myform.scx from a menu, I have Scenario 2, and myprog.prg looks like this.
* Lots of initialisation code
DO menu.mpr
DEFINE CLASS clsMyFuncs AS Custom
FUNCTION FmtBigDate
. . .
RETURN Answer
ENDEFINE
In this case myform.init() fails with the message : Class definition CLSMyFuncs is not found.
I am puzzled at the difference between the two cases. Why can I “see” the class definition in the first case but not in the second?
Myprog.prg also defines a class, clsmyfuncs whose purpose is to contain several useful functions.
So in Scenario 1, myprog.prg looks like this
* Lots of initialisation code
DO myform.scx
DEFINE CLASS clsMyFuncs AS Custom
FUNCTION FmtBigDate
. . .
RETURN Answer
ENDEFINE
This works fine, and within myform.Init() I can say
.zMyFuncs = CREATEOBJECT("clsMyFuncs")
. . .and later on call .zmyfuncs.FmtBigDate()
If however I choose to call myform.scx from a menu, I have Scenario 2, and myprog.prg looks like this.
* Lots of initialisation code
DO menu.mpr
DEFINE CLASS clsMyFuncs AS Custom
FUNCTION FmtBigDate
. . .
RETURN Answer
ENDEFINE
In this case myform.init() fails with the message : Class definition CLSMyFuncs is not found.
I am puzzled at the difference between the two cases. Why can I “see” the class definition in the first case but not in the second?