Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to close modal forms on shutdown?
Message
From
30/03/2002 15:21:35
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00639127
Message ID:
00639181
Views:
16
Thanks Sergey,

I wan hoping you would respond.
It appears that you cannot suspend in the on shutdown procedure. I have tried.
As I had no response till now, in desperation I created another thread with a different heading. See message #639169 for details on what I am trying to do. I also have a test program with modeless and modal forms, browse and message box to test on shutdown. If you would like to take a stab at this, I will be glad to send it to you. I have tried everything I know to try.

I put message boxes in on shutdown and strtofile to log what was happening.
This is the on shutdown procedure.
clear events 
   wait window "all events are cleared" timeout 1
=strtofile("Started on shutdown procedure"+chr(13)+chr(10) ,"shutdowntrace.txt",.t.)
if _screen.formcount > 0
	m.testcount = 0
	=strtofile("Forms collection "+chr(13)+chr(10) ,"shutdowntrace.txt",.t.)
	for m.xx = 1 to _screen.formcount
		=strtofile("_screen.forms("+alltrim(str(m.xx))+") = "+_Screen.forms(m.xx).name+chr(13)+chr(10) ,"shutdowntrace.txt",.t.)
	next
	=strtofile("End of Forms collection "+chr(13)+chr(10)+chr(13)+chr(10) ,"shutdowntrace.txt",.t.)
	do while _screen.formcount > 0
		m.form1 = _screen.forms(1).name
		=strtofile("attempting to release form "+"_screen.forms(1) = "+_Screen.forms(1).name+chr(13)+chr(10) ,"shutdowntrace.txt",.t.)
		wait window "attempting to release form "+_Screen.forms(1).name timeout 1
		*!* this code will release a modal form but the next form will not release
		*!*	if _Screen.forms(1).windowtype = 1 && is a modal screen
	*!*		m.thisactiveform = _screen.forms(1)
		*!*		m.thisactiveform.visible = .f.
		*!*		m.thisactiveform.show(2)
		*!*		m.thisactiveform.release
		*!*		m.thisactiveform = .null.
		*!*		release  m.thisactiveform
		*!*	else
		*!* is not a modal screen
		*!* this code will release a a modeless form but not a modal form
		
		_Screen.forms(1).release
	
		*!*	endif
		wait clear
		if 	_screen.formcount > 0 and m.form1 = _screen.forms(1).name
			*!* form did not release increment retry count to try up to to times to release
			*!*  to prevent infinite loop if unable to release form
			m.testcount =m.testcount+1
		else
			m.testcount = 0
		endif
		if m.testcount > 10
			*!* try
			exit
			wait window "could not release forms"
		endif
	enddo
endif
release all extended
wait window "clearing all" timeout 1
*!* clear all returns error "cannot clear object in use" when modal screen is active
clear all
flush
on shutdown
wait window "finished on shutdown" timeout 1
=strtofile("Finished shutdown procedure"+chr(13)+chr(10) ,"shutdowntrace.txt",.t.)
quit
Shutdowntrace.txt shows each form in the forms collection and each atttempt to release. When all active forms are modeless, there is no problem. But if Modal form, browse window or message box, release does not work and the app will not shutdown.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform