Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Application Object
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00755742
Message ID:
00755750
Views:
8
>I have been attempting to write an Application Object which sets up the environment (set commands needed), set up the error handler and shutdown procedures, set up temp folder location, open Database and launch the main menu ...etc. The advantage would be to have self contained code whose class can be dropped in a project and most of the App foundation is created upon instantiating the App object in the main program leaving it lean.
>
>The problem is when activating the 'shutdown' process, I get always an error ' THIS can only be used within a method'
>
>In the 'init' method of the AppMgr class, I have: 'on shutdown do this.release'.
>
>Its release method looks like:
>*******
>WAIT WINDOW 'Shutting Down...' TIMEOUT .5
>CLEAR ALL
>RELEASE ALL
>HIDE WINDOW all
>CLEAR EVENTS
>********
>
>The line containing 'read events' is where the program crashes when I step through the code. I placed that line in both the main.prg and the 'init' method of the class with no sucess in both cases.
>
>I use VFP 7.0 SP1.
>
>Any theories as to why this error takes place?
>
>Many thanks.

You can't use THIS in that situtaion. <g> Look at it this way, when the system starts to do a shutdown, it's happening outside of your object, so "this" has no reference point. Change it to be oAppMgr.Release() (or whatever your application object name is) and you'll have much better luck with it.
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform