Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Form won't stay open
Message
 
 
À
18/05/2009 07:20:21
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01400297
Message ID:
01400519
Vues:
90
>
>In addition to what Naomi already said: a modal form does not require a (secondary) Read Event.
>If it does, that means that is not effectively modal.
>Typical reasons may be that either yourform.ShowWindow=2 && AsTopLevel - if so, the form cannot be modal, WindowType is ignored (or being reset to default at runtime, respectively).
>Or your code somehow mixes up the event sequence - for instance, if you do something like "Thisform.SomeControl.SetFocus()" in form.Init(), then the form would get visible too early and you might get surprising effects.
>Or your reference variable somehow gets assigned unintentionally, especialy since you said it's a Public one
>IOW, this sequence should be relatively safe as long as ShowWindow=0 or 1, the WindowType property would be ignored:
>
>
>
>Local loMyModalForm As Form
>Do Form forms\modalForm.SCX Name loMyModalForm NoShow
>Assert (m.loMyModalForm.Visible = .F.) Message "form got visible too early, wrong custom code somewhere in the form events"
>Assert (m.loMyModalForm.ShowWindow < 2) Message "top-level forms cannot be modal"
>loMyModalForm.Show(1) && modal, no Read Events required
>&& MESSAGEBOX("This line must not run before modalForm is released or hidden")
>RETURN
>
>
>
>hth
>-Stefan

Thank you all very much for your help!

Stefan,

It was very helpful that you indicated that when the ShowWindow is set to 2 the type Modal is ignored. I didn't know that.

And I found that the main problem was that I have CONFIG.FPW with line Screen=Off. This apparently releases the Modal form. Once I set the _SCREEN.VISIBLE = .T. before the modal form it does stay open until closed.

By the way to all suggestions about SET STEP ON. The problem was only manifesting when I was running the program at run-time. Executing from IDE was not an issue. So I could not use the SET STEP ON.

The only little issue now is that when I set the _SCREEN.VISIBLE = .T. right before instantiating the Modal form the user will see the VFP window in the background. It is not a big deal although it would be nice if I could make it invisible.

Again, thank you all.
"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