Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cannot clear object in use
Message
From
08/09/1999 21:14:03
Dennis Schuette
Customized Business Services, Llc
Yuma, Arizona, United States
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00262410
Message ID:
00262694
Views:
17
>Denis,
>
>If you are quiting, and that is what ON SHUTDOWN does, why do you need to CLEAR ALL before you QUIT? I think you can simply remove the clear all line.
>
>The reason you are getting this is because some object is active when the ON SHUTDOWN gets called. When the QUIT is hit the objects will be released but before that they exist and are active. VFP cannot clear an object that is active with the CLEAR command.

I should have been more specific. I am using the wizard to create the project and it is based on the APPWIZ.WZAPPLICATION class. I changed the Shutdown() function in Main.prg to 'cancel' instead of 'Quit' so that in development I stay in VFP, while in the .EXE it returns to Windows.

The Shutdown() function had 'clear all' in it and it worked just fine when my I issued 'oApp.Release()' in my cmdQuit button when it was on a regular form. When I turned the same form into a class, the 'oApp.Release()' left me with the dreaded "Cannot Quit Visual FoxPro' problem. Now in the cmdQuit.Click I have:

ThisForm.Release()
=ShutDown()

and Shutdown contains:

FUNCTION ShutDown
Cleanup()
cancel && changed from QUIT
ENDFUNC


FUNCTION Cleanup

IF CNTBAR("_msysmenu")=7
RETURN
ENDIF
ON ERROR
ON SHUTDOWN
SET CLASSLIB TO
SET PATH TO
CLEAR ALL && causes a 'Cannot clear objects in use'
*!* CLOSE ALL
POP MENU _msysmenu
RETURN

While I am developing I always have to do the following in the command window:

clear all
set sysmenu to default

This only started happening when I turned the form into a class. I just don't understand!

Denis
Dennis Schuette
Previous
Reply
Map
View

Click here to load this message in the networking platform