Jussip Posted September 21, 2008 Share Posted September 21, 2008 Hey againg =) I made a gui, and when pressed a button on it, it pops another gui. And when i try to close the popped gui, both gui's close, how i can put so that both wont close? Link to comment Share on other sites More sharing options...
AlmarM Posted September 21, 2008 Share Posted September 21, 2008 (edited) Hello, You need to open the second gui with a func. Ill give a short example. expandcollapse popup#include <GUIConstantsEx.au3> $GUI = GUICreate() $Button1 = GUICtrlCreateButton() GUISetState() While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Exit Case $nMsg = $Button1 _SecondGUI() EndSelect WEnd Func _SecondGUI() GUISetState(@SW_DISABLE, $GUI) $GUI2 = GUICreate() $Button2 = GUICtrlCreateButton() GUISetState() While 2 $nMsg2 = GUIGetMsg() Select Case $nMsg2 = $GUI_EVENT_CLOSE ExitLoop Case $nMsg2 = $Button1 ; Do some stuff EndSelect WEnd GUIDelete($GUI2) GUISetState(@SW_ENABLE, $GUI) GUISetState(@SW_RESTORE, $GUI) EndFunc Hope it helps! AlmarM Edited September 21, 2008 by AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
Andreik Posted September 21, 2008 Share Posted September 21, 2008 Hey againg =) I made a gui, and when pressed a button on it, it pops another gui. And when i try to close the popped gui, both gui's close, how i can put so that both wont close? Something like this? $GUI1 = GUICreate("GUI1", 100, 100) $NEW = GUICtrlCreateButton("NEW",25,25,50,50) GUISetState(@SW_SHOW,$GUI1) While 1 $MSG = GUIGetMsg(1) Switch $MSG[0] Case $NEW GUISetState(@SW_DISABLE,$GUI1) $GUI2 = GUICreate("GUI2",200,200) GUISetState(@SW_SHOW,$GUI2) Case -3 If $MSG[1] = $GUI1 Then Exit GUISetState(@SW_ENABLE,$GUI1) GUIDelete($GUI2) EndSwitch WEnd When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Valuater Posted September 21, 2008 Share Posted September 21, 2008 Hello, You need to open the second gui with a func. Ill give a short example. expandcollapse popup#include <GUIConstantsEx.au3> $GUI = GUICreate() $Button1 = GUICtrlCreateButton() GUISetState() While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Exit Case $nMsg = $Button1 _SecondGUI() EndSelect WEnd Func _SecondGUI() GUISetState(@SW_DISABLE, $GUI) $GUI2 = GUICreate() $Button2 = GUICtrlCreateButton() GUISetState() While 2 $nMsg2 = GUIGetMsg() Select Case $nMsg2 = $GUI_EVENT_CLOSE ExitLoop Case $nMsg2 = $Button1 ; Do some stuff EndSelect WEnd GUIDelete($GUI2) GUISetState(@SW_ENABLE, $GUI) GUISetState(@SW_RESTORE, $GUI) EndFunc Hope it helps! AlmarM all that effort and it doesn't even work!!!...??? 8) Link to comment Share on other sites More sharing options...
AlmarM Posted September 21, 2008 Share Posted September 21, 2008 (edited) all that effort and it doesn't even work!!!...???8)What do you mean it doesnt work??AlmarMEDIT:Tested and it seems to work for me Edited September 21, 2008 by AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
Valuater Posted September 21, 2008 Share Posted September 21, 2008 What do you mean it doesnt work??AlmarMdid you actually test it????as "one" example$GUI = GUICreate()this line errors for me8) Link to comment Share on other sites More sharing options...
Andreik Posted September 21, 2008 Share Posted September 21, 2008 What do you mean it doesnt work??AlmarMHe wanted to say it was better a completely code. Not GuiCreate() and GuiCtrlCreateButton(). When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Jussip Posted September 21, 2008 Author Share Posted September 21, 2008 (edited) Hello, You need to open the second gui with a func. Ill give a short example. expandcollapse popup#include <GUIConstantsEx.au3> $GUI = GUICreate() $Button1 = GUICtrlCreateButton() GUISetState() While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Exit Case $nMsg = $Button1 _SecondGUI() EndSelect WEnd Func _SecondGUI() GUISetState(@SW_DISABLE, $GUI) $GUI2 = GUICreate() $Button2 = GUICtrlCreateButton() GUISetState() While 2 $nMsg2 = GUIGetMsg() Select Case $nMsg2 = $GUI_EVENT_CLOSE ExitLoop Case $nMsg2 = $Button1 ; Do some stuff EndSelect WEnd GUIDelete($GUI2) GUISetState(@SW_ENABLE, $GUI) GUISetState(@SW_RESTORE, $GUI) EndFunc Hope it helps! AlmarM uhh ok Edited September 21, 2008 by Jussip Link to comment Share on other sites More sharing options...
Valuater Posted September 21, 2008 Share Posted September 21, 2008 EDIT:Tested and it seems to work for me What version of Autoit are you running?8) Link to comment Share on other sites More sharing options...
Valuater Posted September 21, 2008 Share Posted September 21, 2008 (edited) He wanted to say it was better a completely code. Not GuiCreate() and GuiCtrlCreateButton().Thats right...Even better, if the OP would shows us the code that erorred on him, then we could adjust his code...but we just get "uhh ok"geeze8) Edited September 21, 2008 by Valuater Link to comment Share on other sites More sharing options...
AlmarM Posted September 21, 2008 Share Posted September 21, 2008 He wanted to say it was better a completely code. Not GuiCreate() and GuiCtrlCreateButton(). Oh, well. What do you/he think about this ? expandcollapse popup#include <GUIConstantsEx.au3> $GUI = GUICreate("2nd GUI Example", 100, 80) $Button1 = GUICtrlCreateButton("Open GUI", 10, 10, 80) GUISetState() While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Exit Case $nMsg = $Button1 _SecondGUI() EndSelect WEnd Func _SecondGUI() GUISetState(@SW_DISABLE, $GUI) $GUI2 = GUICreate("2nd GUI Example", 100, 80) $Button2 = GUICtrlCreateButton("Close GUI", 10, 50, 80) GUISetState() While 2 $nMsg2 = GUIGetMsg() Select Case $nMsg2 = $GUI_EVENT_CLOSE ExitLoop Case $nMsg2 = $Button2 ExitLoop EndSelect WEnd GUIDelete($GUI2) GUISetState(@SW_ENABLE, $GUI) GUISetState(@SW_RESTORE, $GUI) EndFunc AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
AlmarM Posted September 21, 2008 Share Posted September 21, 2008 (edited) Thats right...Even better, if the OP would shows us the code that erorred on him, then we could adjust his code...but we just get "uhh ok"geeze8)Haha true!AlmarM Edited September 21, 2008 by AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
Valuater Posted September 21, 2008 Share Posted September 21, 2008 Oh, well. What do you/he think about this ? ... AlmarM Much, much better... now just learn to use "Tidy" and make it real clean 8) Link to comment Share on other sites More sharing options...
Jussip Posted September 21, 2008 Author Share Posted September 21, 2008 all go check my new post.. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now