Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Completely puzzled!
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Completely puzzled!
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01111192
Message ID:
01111192
Vues:
54
Hi everybody,

I just spent ~ 1h. trying to figure out the problem. I've noticed, that my form closes when I run some process. Here is some logic:

In the form's button's click I call form's method. This method instantiates a session based class, that does some process.

To make the story short, I found the culprit. It's this class, that I instantiate in the beginning of my method's code:
**************************************************
*-- Class:        SaveSettings
*-- ParentClass:  custom
*-- BaseClass:    custom
*---Created by:   Nadya Nosonovsky
*-- Time Stamp:   10/18/05 09:07:11 PM
*
define class SaveSettings as custom

*-- Holds SET TALK setting at initialization.
	protected cOldSetTalk
	cOldSetTalk = ""
*-- Holds SET NOTIFY setting at initialization.
	cOldSetNotify = ""
*-- Holds the output window at initialization.
	protected cOldOutputWindow
	cOldOutputWindow = ""
*-- Holds the name of the temporary output window.
	protected cNewOutputWindow
	cNewOutputWindow = ""
*----Holds Escape settings
	protected cOnEscape
	cOnEscape= ""
	protected cSetEscape
	cSetEscape = ""
	name = "SaveSettings"

	procedure destroy
	set talk off
	local ;
		lcNewOutputWindow, ;
		lcOldOutputWindow, ;
		lcOldSetNotify, ;
		lcOldSetTalk, lcOnEscape, lcSetEscape

	with this
		lcNewOutputWindow = .cNewOutputWindow
		lcOldOutputWindow = .cOldOutputWindow
		lcOldSetNotify = .cOldSetNotify
		lcOldSetTalk = .cOldSetTalk
		lcOnEscape = .cOnEscape
		lcSetEscape = .cSetEscape
	endwith

	if version(5)>=700
		set notify &lcOldSetNotify
	endif

	set talk &lcOldOutputWindow

	release windows &lcNewOutputWindow

	set talk &lcOldSetTalk
* Now restore our settings
	on escape &lcOnEscape

	if m.lcSetEscape = "OFF"
		set escape off
	else
		set escape on
	endif

	endproc

	procedure init
	with this
		.cOldSetTalk = set("TALK")
		.cOldOutputWindow = set("TALK",1)
		.cOnEscape = on('ESCAPE')
		.cSetEscape = set('ESCAPE')

		if version(5)>=700
			.cOldSetNotify = set("NOTIFY")
		endif
	endwith

	return .t.
	endproc

enddefine
*
*-- EndDefine: SaveSettings
**************************************************
The purpose of this class is to restore some basic settings that may be changed.
I found that if I comment out creation of this class, the form doesn't auto close. If I put it back, the form closes.

The form is actually a class and it's called by MereMortals DoForm function from the menu. The form is modal.

Do you see, what could be wrong in my logic? Why would this class cause my form to close?

Thanks a lot in advance.
If it's not broken, fix it until it is.


My Blog
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform