Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
This can't be impossible to do
Message
De
30/03/2002 17:35:53
 
 
À
30/03/2002 17:15:12
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00639169
Message ID:
00639199
Vues:
22
Hi Cetin,
Thanks for the reply.
I tried _screen.forms(1).hide before release and it does release the modal form but then the form that called the modal form will not release. See comments in code below. Makes no change when browse or messagebox is displayed. I put wait windows and strtofile() lines to trace what was happening.
Procedure onshutdown

	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).hide()
			_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
                             =strtofile("Failed to release form "+"_screen.forms(1) = "+_Screen.forms(1).name+chr(13)+chr(10) ,"shutdowntrace.txt",.t.)

				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
After shutdown, Shutdowntrace.txt contained
Started on shutdown procedure
Forms collection 
_screen.forms(1) = TEST2modal
_screen.forms(2) = Form1
End of Forms collection 

attempting to release form _screen.forms(1) = TEST2modal
attempting to release form _screen.forms(1) = TEST2modal
attempting to release form _screen.forms(1) = Form1
attempting to release form _screen.forms(1) = Form1
attempting to release form _screen.forms(1) = Form1
attempting to release form _screen.forms(1) = Form1
attempting to release form _screen.forms(1) = Form1
attempting to release form _screen.forms(1) = Form1
attempting to release form _screen.forms(1) = Form1
attempting to release form _screen.forms(1) = Form1
attempting to release form _screen.forms(1) = Form1
attempting to release form _screen.forms(1) = Form1
attempting to release form _screen.forms(1) = Form1
Failed to release form _screen.forms(1) = Form1
Finished shutdown procedure
When it gets to clear all line it errors on "Cannot clear current object in use". Sounds like a dangling reference to me but where? And how to close other modal screens?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform