Sign in to follow this  
Followers 0
CrewXp

Create a separate GUI, that grey's out the GUI that called it? Returns to original GUI when exited?

5 posts in this topic

Hey, I'm having a LOT of trouble, when I know I shouldn't be. When I exit the second, the first exits, and not the second. Another way I've tried, everything exits, and another time, the original doesn't work anymore.

Anywho...

I have a GUI which has LOTS of buttons. One of the buttons is supposed to call a pop-up GUI, which has options, functions like a regular gui.

But if the user tries to click on the background GUI, he can't click or do anything in it.

Then once the second GUI which has been called, is exited, then that GUI exit's, and the original GUI gains back it's focus.

It's like this....

Main GUI
|        |
V       V
  Button
Second GUI (Greys out main GUI. Function switches to this GUI).
|        |
V       V
Exit Command on 2nd GUI
|        |
V       V
First is Enabled like nothing ever happened..

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

;-------------------------------------------------------------------------------
; Hide

Func dialogHide()
    GUISetState(@SW_ENABLE, $GUIMain)
    GUISetState(@SW_HIDE, $GUIDialog)
    WinActivate($GUIMain)
EndFunc

;-------------------------------------------------------------------------------
; Show

Func dialogShow()
    GUISetState(@SW_DISABLE, $GUIMain)
    GUISetState(@SW_SHOW, $GUIDialog)
    WinActivate($GUIDialog)
EndFunc

I think these functions do what you're looking for... right? Just replace the variables with whatever you need ($GUIMain would be the handle to the original window, and $GUIDialog the ID to the popup dialog). Use them in the while loop, or as onevent actions (whichever method suits your needs).

Edited by -Ultima-

[ WinINet.au3 | Array.au3 (Optimized) | _UnixTimeParse() ]

Share this post


Link to post
Share on other sites

I think he means something more like this:

#include <GUIConstants.au3>


$Form1 = GUICreate("Form1", 479, 281, 157, 153)
$Button1 = GUICtrlCreateButton("Create Child GUI", 140, 92, 171, 77, 0)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            _CreateChild()
    EndSwitch
WEnd

Func _CreateChild()
    GUISetState(@SW_DISABLE,$Form1)
    $Form2 = GUICreate("Form2", 277, 211, 252, 176,-1,-1,$Form1)
    $Label1 = GUICtrlCreateLabel("This is a child GUI", 90, 28, 90, 17)
    $Label2 = GUICtrlCreateLabel("The other GUI is disabled.", 72, 58, 127, 17)
    GUISetState(@SW_SHOW)
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
    WEnd
    GUISetState(@SW_ENABLE,$Form1)
    GUIDelete($Form2)
EndFunc

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

That's just a difference in implementation. IMHO, if the dialog can possibly be reused over and over, then it *shouldn't* be deleted, and should simply be hidden. Recreating a GUI over and over each time the button is pressed is... an unnecessary waste of time/resources.

Just create the GUI once, and leave it hidden. When you need it, unhide it using dialogShow(). When you want to close it, use dialogHide(). The more complex the popup dialog is, the worse it is to recreate it every time it needs to be unhidden.

Edited by -Ultima-

[ WinINet.au3 | Array.au3 (Optimized) | _UnixTimeParse() ]

Share this post


Link to post
Share on other sites

thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0