Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Form won't stay open
Message
 
 
À
19/05/2009 04:06:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01400297
Message ID:
01400576
Vues:
68
>
>Dmitry, you are welcome. As for the top-level forms that cannot be modal:
>in a scenario where you want _screen.Visible=.F. and your top-level form is the first one, like a login form for instance, you can indeed use two (or more) Read Event lines in your code. Since there can be only one Read Events in effect at the same time, each one would need its own Clear Events counterpart though, so that the sequence in your main.prg can perhaps look like the following example.prg:
>
>
>LOCAL lScreenVisible
>lScreenVisible = _screen.Visible
>_screen.Visible = .F. && or even better "screen=off" in a config.fpw
>
>LOCAL oLoginForm as Form
>oLoginForm = CREATEOBJECT('LoginForm')
>oLoginForm.Show()
>READ EVENTS
>
>LOCAL lLoginSuccess
>IF VARTYPE(m.oLoginForm) = 'O'
>	lLoginSuccess = m.oLoginForm.lSuccess
>	oLoginForm.Release() 
>ENDIF
>
>LOCAL oMainForm as Form
>IF m.lLoginSuccess
>	oMainForm = CREATEOBJECT('MainForm',m.lScreenVisible) 
>	oMainForm.Show()
>	READ EVENTS 
>ENDIF
>
>RETURN
>
>
>DEFINE CLASS LoginForm as Form
>	ShowWindow = 2
>	AutoCenter = .T.
>	Caption = "Login Form"
>	lSuccess = .F.
>
>	ADD OBJECT cmdCancel as CommandButton WITH ;
>		Left = 150, Top = 200, Height = 24, Caption = "Cancel"
>	PROCEDURE cmdCancel.Click()
>		CLEAR EVENTS
>	ENDPROC
>	ADD OBJECT cmdSuccess as CommandButton WITH ;
>		Left = 50, Top = 200, Height = 24, Caption = "Login"
>	PROCEDURE cmdSuccess.Click()
>		Thisform.lSuccess = .T.
>		CLEAR EVENTS
>	ENDPROC
>ENDDEFINE
>
>DEFINE CLASS MainForm as Form
>	ShowWindow = 2
>	AutoCenter = .T.
>	Caption = "Main Form"
>	lScreenVisible = .F.
>
>	ADD OBJECT cmdCancel as CommandButton WITH ;
>		Left = 150, Top = 200, Height = 24, Caption = "Close"
>	PROCEDURE cmdCancel.Click()
>		CLEAR EVENTS
>		Thisform.Release()
>	ENDPROC
>
>	PROCEDURE Init(tlScreenVisible)
>		This.lScreenVisible = m.tlScreenVisible
>	ENDPROC
>	PROCEDURE Destroy
>		_screen.Visible = This.lScreenVisible
>	ENDPROC
>ENDDEFINE
>
>
>
>hth
>-Stefan

Stefan,

Thank you very much for the solution!
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform