Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Close top form from toolbar
Message
 
 
À
27/01/2005 17:53:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00981030
Message ID:
00981801
Vues:
37
Here is my process:

In my TLF:
*!* INIT - actually I BINDEVENT the INIT to _Post_Init method
WITH THIS
     .CAPTION = APPLICATION_CAPTION
     IF NOT PEMSTATUS(THIS, 'cMenuName', 5)
          .ADDPROPERTY('cMenuName', '')
     ENDIF
     .cMenuName = 'DeskMenu'
ENDWITH
DO (MAIN_MENU_NAME) WITH THIS, THIS.cMenuName

*!* UNLOAD - actually I BINDEVENT the UNLOAD to _Pre_Unload method
goApp.KillEvents()

*!* DESTROY - actually I BINDEVENT the DESTROY to _Pre_Destroy method
*!* garbage collection here
THIS.oMyToolBar = .null.
SET SYSMENU TO Default

*!* In my MAIN PRG
ON SHUTDOWN goApp.KillEvents()
DO FORM MyTopLevelForm
READ EVENTS
*** some cleanup stuff here
AFTER my KillEvents runs, then I get my object ref to the TLF and release it.
*** From App class ***
PROCEDURE KillEvents
     IF THIS.lKilled
          RETURN
     ENDIF
     IF THIS.ReleaseObjects()
          CLEAR EVENTS
          THIS.lKilled = .T.
     ELSE
          RETURN .F.
     ENDIF
ENDPROC
PROTECTED PROCEDURE ReleaseObjects
     IF THIS.FormList.COUNT = 0
          RETURN .T.
     ENDIF
     LOCAL lnItem, loForm
     lnItem = 0
     IF NOT EMPTY(THIS.FormList.ActiveFormHwnd)
          lnItem = THIS.FormList.GETKEY(THIS.FormList.ActiveFormHwnd)
     ENDIF
     IF lnItem > 0
          loForm = THIS.FormList.ITEM(lnItem)
          IF loForm.SHOWWINDOW = 2
               *!*     Do not close the top-level form
               LOOP
          ENDIF
          IF loForm.WINDOWTYPE = 1
               *!*     if the active form is modal, do not shutdown
               RETURN .F.
          ENDIF
     ENDIF
     LOCAL lnI, lnKount, loForm
     lnKount = THIS.FormList.COUNT
     FOR lnI = lnKount TO 1 STEP -1
          loForm = THIS.FormList.ITEM(lnI)
          loForm.QUERYUNLOAD()
     ENDFOR
ENDPROC
Mark McCasland
Midlothian, TX USA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform