>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