Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Releasing while the Preview Window open
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01121802
Message ID:
01121807
Views:
30
>The SET SYSMENU TO DEFAULT should be enough. If it doesn't restore VFP menu then the application didn't closed properly.

Here is the code from the CleanUp method:
lparameters tlForceShutDown

local lcOnShutdown, llQuit

_screen.mousepointer = MOUSE_HOURGLASS

*-----------------------------------
*--- Close all applications forms
*-----------------------------------
with this
	if wexist('Report Designer')
		*set sysmenu to default && Restore standard menu
		release windows 'Report Designer' && try to close report preview window		
	endif

	if vartype(.oForms) = 'O' and not .oForms.CloseAllForms(m.tlForceShutDown)
		return .f.
	endif

	if vartype(.oUserLogMgr) == 'O'
*-----------------------------------------------------------------
*-- Close the entry in the user log
*-----------------------------------------------------------------
		.LogUserActivity("Logout")

		.oUserLogMgr.release()
	endif

	if vartype(.oRecordMgr) == 'O'
*-----------------------------------------------------------------
*-- Unlock any records the user may have open.
*-----------------------------------------------------------------
		.oRecordMgr.UnlockAll(.cUserid)
		.oRecordMgr.release()
	endif

*-----------------------------------------------------------------
*-- Release the timer and run the parent code.
*-----------------------------------------------------------------
	.ReleaseDesktopTimer()

	.ReleaseAbstractFactory()
	.ReleaseDBCMgr()

*----------------------
*-- Restore the caption
*----------------------
	_screen.caption = .cOldMainWindCaption
	set message to ""

*-------------------------------------
*-- Restore the setting of ON SHUTDOWN
*-------------------------------------
	lcOnShutdown = .cOldOnShutdown
	on shutdown &lcOnShutdown

	.ReleaseSplash()
	.ReleaseToolbar()
	.ReleaseMenu()
	.ShowVFPToolbars()
	.ReleaseDesktopImage()
	.ReleaseChildren()

	.ReleaseGlobalEnvironmentObj()

*--- If the Connection Manager exists, release it
	if vartype(.oConnectionMgr) == "O"
		.oConnectionMgr.release()
	endif

	.oErrorMgr = .null.

*--------------------------------------------------
*-- Indicates that the Cleanup method has already
*-- been run.
*--------------------------------------------------
	.lIsClean = .t.
	_screen.mousepointer = MOUSE_DEFAULT
	close data all
	clear events
	clear program
endwith

if m.llQuit
	quit
endif
All the forms are closed, preview window is closed, so I thought everything is working...

UPDATE. I think I solved the problem then, but don't remember right now how <g>

>>If I want to close the application while having the preview window open, the application closes, but instead of the normal menu I have only Format menu. I have set sysmenu to default in code. If I add it again, I have only Project menu when application closes. What can I do to restore normal menu when application is closed?
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform