Sign in to follow this  
Followers 0
Rental

Multiple Gui's closing at the same time

3 posts in this topic

This has probably been asked a million times but i cant find any answers that help me.

Here is what i have but it closes all the windows when i only want 1 to:

#include <GUIConstantsEx.au3>

GUICreate("")
GUISetState(@sw_show)
$button = GUICtrlCreateButton("New Window",150,150)

Do
    $msg = GUIGetMsg()
    
    If $msg = $button Then
        GUICreate("Gui 2",200,200)
        GUISetState(@sw_show)
        GUISetBkColor(0x000000)
    EndIf
    
Until $msg = $GUI_EVENT_CLOSE

Share this post


Link to post
Share on other sites



use winclose() on the gui you want to close, if you call your second gui Gui 2 then do

winclose("Gui 2")

Interpreters have great power!Although they live in the shadow of compiled programming languages an interpreter can do anything that a compiled language can do, you just have to code it right.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

#include <GUIConstantsEx.au3>
Local $GUI, $GUI2
$GUI = GUICreate("")
GUISetState(@sw_show)
$button = GUICtrlCreateButton("New Window",150,150)

While 1
    $msg = GUIGetMsg()
   
    If $msg = $button Then
        $GUI2 = GUICreate("Gui 2",200,200)
        GUISetState(@sw_show)
        GUISetBkColor(0x000000)
    EndIf
    If $msg = $GUI_EVENT_CLOSE Then
         If $Gui2 Then
             GUIDelete($Gui2)
             $GUI2 = ""
         Else
             Exit 0
         EndIf
         
    Endif
    
   
Wend

Edited by Dampe

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