Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Close top form from toolbar
Message
From
28/01/2005 14:29:41
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00981030
Message ID:
00981858
Views:
42
>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
So, what actually releases top form? QUERYUNLOAD?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform