Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to call modal form from modal form PROPERLY?
Message
De
01/02/2001 08:15:58
 
 
À
01/02/2001 04:43:28
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00471146
Message ID:
00471162
Vues:
22
>Hello everybody,
>
>
>I have a problem with calling second modal form from another modal form.
>Usualy I have the following code to run second moddal form:
>
>if type([thisform.roObj])=[O] and !isnull(thisform.roObj)
>else
>thisform.roObj=createobj([secondmodalform])
>endif
>thisform.roObj.Show()
>
>
>instead of releasing second form I just Hide() it, so, it could be reused on next button click
>this code works just fine for first time but then on second or third run second modal form shows up active but BEHIND the first form.
>
>So, the question is how to avoid this, is there any way to bring second modal form to top in any case?
>


Yes; save the hWnd of the Form to a Form property (call it nhWnd) introduced at RunTIme, the first time it's actually displayed by:

* In Show and Activate methods, add the following code:
=DODEFAULT()  && pass the parameter along, too!
DECLARE INTEGER GetActiveWindow IN WIN32API
IF TYPE('thisform.nhWnd') = 'U'
   thisform.AddProperty('nhWnd',GetActiveWindow())
ENDIF
DECLARE INTEGER SetForegroundWindow IN WIN32API INTEGER
=SetForegroundWindow(thisform.nhWnd)
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform