Jump to content

How to close window with button?


Recommended Posts

Hi,

here is my part of a script:

$Loginchild = GUICreate("Login", 200, 100)
                GUISetState(@SW_SHOW)
                GUICtrlCreateLabel("Account:", 10, 10)
                $loginname = GUICtrlCreateInput("", 62, 10, 65, 18)
                GUICtrlCreateLabel("Password:", 10, 40)
                $PW = GuiCtrlCreateInput("", 62, 40, 65, 18)
                $loginsend = GUICtrlCreateButton("OK!", 20, 70, 35)
                $cancellogin = GUICtrlCreateButton("Cancel", 70, 70, 50)


            Case $msg = $loginsend
                iniwrite("server.ini", "Login", "Name", guictrlread($loginname))
                iniwrite("server.ini", "Login", "PW", guictrlread($PW))
            ;GuiDelete($Loginchild) <-- 

            Case $msg = $cancellogin
                GUIDelete($Loginchild)

If you click on the OK! Button the Childwindow should close, it does not work.

Link to comment
Share on other sites

Maybee...

$Loginchild = GUICreate("Login", 200, 100)
GUICtrlCreateLabel("Account:", 10, 10)
$loginname = GUICtrlCreateInput("", 62, 10, 65, 18)
GUICtrlCreateLabel("Password:", 10, 40)
$PW = GUICtrlCreateInput("", 62, 40, 65, 18)
$loginsend = GUICtrlCreateButton("OK!", 20, 70, 35)
$cancellogin = GUICtrlCreateButton("Cancel", 70, 70, 50)
GUISetState(@SW_SHOW)

While 1
 $msg = GUIGetMsg()
 
 Select
  Case $msg = $loginsend
   ;IniWrite("server.ini", "Login", "Name", GUICtrlRead($loginname))
   ;IniWrite("server.ini", "Login", "PW", GUICtrlRead($PW))
   GuiDelete($Loginchild) ;<--
   ExitLoop
   
  Case $msg = $cancellogin
   GUIDelete($Loginchild)
   ExitLoop
 EndSelect
 
WEnd

8)

NEWHeader1.png

Link to comment
Share on other sites

Just tested again and it works for me... I just commented out the iniwrite stuff.

I do not know how this is utilized in your complete Script

8)

EDIT: If you are "re-using" this child GUI, you should "Hide" and "Show" the GUI instead of deleting it

Edited by Valuater

NEWHeader1.png

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...