Jump to content

GUI showing and closing from another GUI


Recommended Posts

Hello,

I have a script which has a GUI. from that gui if I click a button, another gui pops up.

When I close the second GUI, also the main gui si closing. How I can prevent this?

I tried this:

#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiButton.au3>

$first_gui = GUICreate("first gui",350,350,-1,-1,-1,-1)
$secondGUI = GUICtrlCreateButton("second gui",120,140,100,30,-1,-1)
GUISetState(@SW_SHOW,$first_gui)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        
        
        
        Case $secondGUI
        $secondgui = GUICreate("second gui",194,111,-1,-1,-1,-1)
GUISetState(@SW_SHOW,$secondgui)
        
        
        
        

    EndSwitch
WEnd

 

I tried this:

#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiButton.au3>

$first_gui = GUICreate("first gui",350,350,-1,-1,-1,-1)
$secondGUI = GUICtrlCreateButton("second gui",120,140,100,30,-1,-1)
GUISetState(@SW_SHOW,$first_gui)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        
        
        
        Case $secondGUI
        $secondgui = GUICreate("second gui",194,111,-1,-1,-1,-1)
GUISetState(@SW_SHOW,$secondgui)
        
        While 2
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            
        GUISetState(@SW_HIDE,$secondgui)
        
        
    EndSwitch
WEnd
        
        

    EndSwitch
WEnd

And my second GUI is closing without closing the main gui, BUT the problem is that now if I click the button, no second gui shows up.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...