Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need help closing an VFP6.0 EXE
Message
From
02/09/1999 10:04:49
 
 
To
02/09/1999 08:42:51
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00260440
Message ID:
00260580
Views:
16
>Erik,
>
>I have the on shutdown in my main menu with a shutdown program with the following code:
>
>CLEAR EVENTS
>CLEAR READ ALL
>close all
>clear all
>quit
>
>But if there is a form open and I click on the close "x" in the upper rigth or the close in close-box, I get an error an alias is not found, it is looking for a dbf to close. What am I doing wrong? Do you consult over the phone and what are your rates per incident?
>
>Pat

That sounds like a separate problem altogether. My framework handles READ EVENTS/ON SHUTDOWN like this:

in the main, startup program:

ON SHUTDOWN OnShutDown()
PUBLIC goApp
goApp = CREATEOBJECT("cusApp")
goApp.ReadEvents()

RELEASE goApp


The CusApp::ReadEvents method goes:

DO WHILE .T.
*-- Start the event loop
READ EVENTS
*- We do cleanup here, instead of in the menu code
*- because windows cannot be released from the menu code if
*- a grid has the focus.
IF THIS.Cleanup()
EXIT
ENDIF
ENDDO

The File->Exit menu item simply issues a CLEAR EVENTS. The OnShutDown procedure reads simply

CLEAR EVENTS
QUIT

The CusApp::Cleanup method reads (among other things):

FOR EACH oForm IN _screen.Forms
IF TYPE("oForm.Name") = "C"
* Toolbar
IF UPPER(oForm.BaseClass) <> "TOOLBAR"
IF oForm.QueryUnload()
oForm.Release()
ELSE
RETURN .F.
ENDIF
ENDIF
ENDIF
ENDFOR


This structure forces the application to use one place for all cleanup code, whether the user selects exit from the menu, clicks the "X", or selects close fromthe control box. Each form has the power to keep the app frm closing by returning .F. from it's QueryUnload method. This gives the form the abillity to ask the user if she wants to save, revert, or cancel the close operation. Each form is asked politely to shutdown, using it's own methods.

This method of app starting and cleanup works flawlessly.

If you still would like to consult on the phone, please email me, and we can discuss rate, etc.
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform