>In many threads application objects are discussed as being one way to avoid using public global variables when there is common information needed by several objects. At this time I am not using a framework of any kind and that is the only place I have seen application objects. Is there an example somewhere of what an application object looks like, how to create one, etc.? Or do people use the appplication wizard and application objects from the framework that comes with VFP?
In my MAIN.PRG, I have the following:
private goApp
goApp = newobject('AppManager', 'AppMgr.FXP')
Because its scope is private, it is visible to every form, procedure, etc., that is called because MAIN.PRG is the first program code to fire in the app. In my AppMgr.PRG, I have something like:
DEFINE CLASS AppManager as CUSTOM
nUserID = 0
nUserName = []
PROTECTED PROCEDURE INIT
ENDPROC
PROCEDURE RELEASE
RELEASE THIS
ENDPROC
PROTECTED PROCEDURE DESTROY
ENDPROC
PROCEDURE App_Error_Handler
ENDPROC
ENDDEF
You can use AddProperty(goApp, 'PropName') anywhere in your app as needed.
Mark McCasland
Midlothian, TX USA