Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Forms as Top-Level Forms cannot stay opened...
Message
De
07/10/2002 11:51:27
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
06/10/2002 22:14:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00708027
Message ID:
00708395
Vues:
8
Juan,
TopLevel forms are always modeless (no matter what the WindowType property is). To enable modality for a TopLevel you might either set its ShowWindow as InTopLevel or emulate modality with a wait state using 'read events'.
Even if a host (TopLevel) is present my preference is to use 'read events'. I always find it hard to explain what 'read events' is in a formal way :) Nonformally it's like "run code up to this point before executing rest of code, and I'll tell you when to go on with a 'clear events'". It's like 'read valid' in fox2x or with an ugly code fragment :
lContinue = .f.
do while !lContinue
*...
if Something
 lContinue = .t.
endif
enddo
I prefer 'read events' because it lets you access any form properties, methods, events of 'modalform' instead of just returning a value to me. ie:
*main.prg 
* Assuming I need a login form before going on 
* and more than one value to check

LOCAL frmLogin, lcTag, lcID, luSomething
DO FORM login NAME frmLogin
READ events
lcTag = frmLogin.Tag
lcID = UPPER(frmLogin.UserID)
luSomething = frmLogin.SomeProperty
frmLogin.release
RELEASE frmLogin
*... && Rest of code calling menus, forms etc
READ events
*... && Clean up and shutdown

* Exit point(s) in login form && Probably button clicks
*...
thisform.Hide()
CLEAR EVENTS
Cetin


>Thank you very much Cetin, this really helped !-)
>
>I was testing several "situations", and really find out the behaviour
>pretty weird.
>
>Would you like to explain why using the fix below it works?
>
>I am calling the first form from a program and doing this :
>
>do form ..\forms\my_first_form.scx
>READ events
>
>Thanks again I think this fix will help more people.
>
>>>Hi,
>>> I created two top-level forms, one which has a simple button, that in the
>>>click event has the code below, the other one(enc_psw_prompt) has a field
>>>to enter a password, and two buttons ok, and cancel.
>>>
>>> Very simple but, the second form enc_psw_prompt, doesn't stay, the code
>>>is just ignoring it, I couldn't find the reason of this behavior.
>>>
>>> Basically if the use of top-level forms.
>>>
>>> I will appreciate any info or solution.
>>>
>>>Thanks!
>>>
>>>* THIS CODE USES THE linked METHOD
>>>DO FORM ..\forms\enc_psw_prompt name fNewData linked && link scope of modal form to local variable
>>>READ EVENTS
>>>cListIDs = fNewData.uReturnValue
>>>RELEASE fNewData && releases both variable and form
>>>
>>>* THIS IS JUST TO LET YOU KNOW, THE PREVIOUS FORM
>>>* WAS LAUNCHED BUT THE READ DIDN'T STOP
>>>lcCurrDir = SYS(5)+SYS(2003)
>>>lcDirLoc = GETDIR(lcCurrDir, "Please locate Atlas installation")
>>>
>>>* THIS IS CALLING THE SAME FORM USING REGULAR CALL
>>>DO FORM enc_psw_prompt
>>>READ EVENTS
>>
>>Juan,
>>Put :
>>
>>this.show
>>read events
>>
>>in 1st form.init.
>>
>>Make the other modal (should set showwindow to InTopLevel).
>>
>>Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform