David,
If you want a global oApp that the whole world can see, just create it in your program startup:
private goApp
goApp = createobject( "MyApp" )
goApp.StartRunning()
Where StartRunning might create a form which could reference the goApp object with goApp.DoThis(). This is ok, but it "forces" an environment to be in place for the form, and it makes the form forever dependent on having a goApp object for it to use.
Another way of linking these objects that gives you more flexibility would be to pass a reference of the object to the form in the StartRunning:
do form TheForm with this
In the TheForm.Init() method:
lparameter oCaller
this.moCaller = oCaller && store reference to the object for later use
Then to use a method you do:
thisform.moCaller.DoThis()
You are still linking two objects with some particular public interface that needs to be in place, i.e. the caller object must have a DoThis() method, but you get away from forcing a particular name on that object
>How do I reference a method in an app created with CreateObject()?
>
>For example, if I have
>
>oApp = CreateObject( "MyApp")
>
>for which MyApp contains a method DoThis(), I can, within MyApp, successfully call this.DoThis(), but if later I have an object in a form opened by MyApp, I cannot figure out how to call that method.
>
>Is it possible, or do I have to keep DoThis() in a proc file?