*---------------------- Location Section ------------------------ * Library: CManager.vcx * Class: CFormMgr * Method: CloseAllForms() *----------------------- Usage Section -------------------------- *) Description: *) Closes all application forms * Scope: Public * Parameters: * 1. tlForceShutDown - If true, close all forms without * running QueryUnload first. * *$ Usage: goApp.oForms.CloseAllForms() *$ * Returns: Logical .T. if all forms were closed, otherwise .F. *--------------------- Maintenance Section ---------------------- * Change Log: * Created: 11/12/97 - KJM * MODIFIED: 03/24/98 - KJM * Rather than referencing the form to be closed as * "_SCREEN.Forms(lnFormToClose)" throughout the method, * saved a reference to the form in loForm. This was * necessary because the call to loForm.QueryUnload() * may launch a MsgSvc form that changes the _SCREEN.Forms * collection. * MODIFIED: 01/20/99 - KJM * Added a check for: * NOT ISNULL(_SCREEN.Forms(lnFormToClose) * MODIFIED: 04/15/99 - KJM * Added the tlForceShutDown parameter. If set to True, * close forms without running "QueryUnload()" first. * MODIFIED 07/06/99 - KJM * Changed this method to close forms in reverse order. * MODIFIED 09/29/99 - KJM * Moved the code that releases the Sidebar form to the * bottom of the method so it releases last. Also added * a check in the FOR loop so the sidebar is not released. * MODIFIED 10/04/99 - KJM * If not in "force shutdown" mode, set the active form's * lWriteBuffer property to .T. * MODIFIED 08/31/00 - KJM * Rather than setting the SideBarForm to .NULL., released * it instead. * MODIFIED 11/04/05 - NN - added check for loForm as object * MODIFIED 03/08/06 - NN - made sure to start with the currently active form first ***************************************************************** LPARAMETERS tlForceShutDown LOCAL lnForm, lnFormToClose, loForm, lnFormCount IF NOT m.tlForceShutDown THIS.SetActiveFormWriteBuffer(.T.) *-- CHANGE - NN - March 08, 2006 - 13:40:50 - added the code bellow IF TYPE("_SCREEN.ActiveForm.name") = "C" loForm = _SCREEN.ACTIVEFORM IF m.loForm.QUERYUNLOAD() *-------------------- *--- Release the form *-------------------- *-- CHANGE - NN - November 04, 2005 - 13:19:21 IF VARTYPE(m.loForm) = "O" m.loForm.RELEASE() ENDIF ELSE _SCREEN.MOUSEPOINTER = MOUSE_DEFAULT RETURN .F. ENDIF ENDIF ENDIF *-------------------------------------------------------------- *-- Loop through all open forms and request that they be closed *-------------------------------------------------------------- lnFormCount = _SCREEN.FORMCOUNT FOR lnFormToClose = m.lnFormCount TO 1 STEP -1 IF TYPE("_SCREEN.Forms(lnFormToClose)") == "O" ; AND NOT ISNULL(_SCREEN.FORMS(m.lnFormToClose)) loForm = _SCREEN.FORMS(m.lnFormToClose) IF "TOOLBAR" == UPPER(m.loForm.BASECLASS) LOOP ENDIF IF VARTYPE(THIS.oSideBarForm) == 'O' AND ; COMPOBJ(m.loForm, THIS.oSideBarForm) LOOP ENDIF IF m.tlForceShutDown m.loForm.RELEASE() ELSE *------------------------------ *--- Run the form's QueryUnload *------------------------------ IF m.loForm.QUERYUNLOAD() *-------------------- *--- Release the form *-------------------- *-- CHANGE - NN - November 04, 2005 - 13:19:21 IF VARTYPE(m.loForm) = "O" m.loForm.RELEASE() ENDIF ELSE _SCREEN.MOUSEPOINTER = MOUSE_DEFAULT RETURN .F. ENDIF ENDIF ENDIF ENDFOR IF VARTYPE(THIS.oSideBarForm) == "O" THIS.oSideBarForm.RELEASE() ENDIF>Hi everybody,