luckyluke Posted June 22, 2008 Share Posted June 22, 2008 Hi. I have some problem with following code: expandcollapse popup; Here is GUI_1 $Form1 = GUICreate("Form1", 378, 256, 193, 125) $Button3 = GUICtrlCreateButton("create", 248, 224, 89, 25, 0) GUISetState(@SW_SHOW) $listview = GUICtrlCreateListView (" Num",10,10,361,201) GUICtrlCreateListViewItem("1",$listview) GUICtrlSetState(-1,$GUI_DROPACCEPTED) ; to allow drag and dropping GUISetState() Next Do $msg = GUIGetMsg () Select Case $msg = $listview MsgBox(0,"listview", "clicked="& GUICtrlGetState($listview),2) Case $msg = $Button3 create() EndSelect Until $msg = $GUI_EVENT_CLOSE func create() ; here is GUI_2 $Form2 = GUICreate("Form2", 378, 256, 193, 125) $cancel = GUICtrlCreateButton("cancel", 248, 224, 89, 25, 0) GUISetState(@SW_SHOW) $listview = GUICtrlCreateListView (" Num",10,10,361,201) GUICtrlCreateListViewItem("1",$listview) GUICtrlSetState(-1,$GUI_DROPACCEPTED) ; to allow drag and dropping GUISetState() Next Do $msg = GUIGetMsg () Select Case $msg = $cancel exit EndSelect Until $msg = $GUI_EVENT_CLOSE endfunc My question is: When i exit GUI_2, GUI_1 exit too. How to exit GUI_2 but GUI_1 do not exit. Thanks Link to comment Share on other sites More sharing options...
sandin Posted June 22, 2008 Share Posted June 22, 2008 expandcollapse popup#include <GUIConstantsEx.au3> $Form1 = GUICreate("Form1", 378, 256, 193, 125) $Button3 = GUICtrlCreateButton("create", 248, 224, 89, 25, 0) $listview = GUICtrlCreateListView (" Num",10,10,361,201) GUICtrlCreateListViewItem("1",$listview) GUICtrlSetState(-1,$GUI_DROPACCEPTED) ; to allow drag and dropping GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg () Switch $msg Case $listview MsgBox(0,"listview", "clicked="& GUICtrlGetState($listview),2) Case $Button3 create() case $GUI_EVENT_CLOSE Exit EndSwitch WEnd func create() $Form2 = GUICreate("Form2", 378, 256, 193, 125, -1, -1, $Form1) $cancel = GUICtrlCreateButton("cancel", 248, 224, 89, 25, 0) $listview = GUICtrlCreateListView (" Num",10,10,361,201) GUICtrlCreateListViewItem("1",$listview) GUICtrlSetState(-1,$GUI_DROPACCEPTED) ; to allow drag and dropping GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg () Switch $msg Case $cancel ExitLoop case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($Form2) endfunc exit = will exit entire script guidelete = will close only selected window (GUI) Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
rasim Posted June 22, 2008 Share Posted June 22, 2008 sandinWhy need to create 2 main loops luckylukeSee here Link to comment Share on other sites More sharing options...
luckyluke Posted June 22, 2008 Author Share Posted June 22, 2008 Thank! But when close GUI_2, Case $listview MsgBox(0,"listview", "clicked="& GUICtrlGetState($listview),2) do not work when i click. Link to comment Share on other sites More sharing options...
luckyluke Posted June 22, 2008 Author Share Posted June 22, 2008 (edited) sandin Why need to create 2 main loops blink.gif luckyluke See here #include <GuiConstants.au3> $hMainGUI = GUICreate("Main GUI", 300, 200) $SwitchButton = GUICtrlCreateButton("Switch", 100, 50, 60, 25) $hChildGUI = GUICreate("Child GUI", 200, 100, -1, -1, -1, -1, $hMainGUI) $SwitchButton1 = GUICtrlCreateButton("cancel", 100, 50, 55, 20) GUISetState(@SW_SHOW, $hMainGUI) While 1 $msg = GUIGetMsg(1) Select Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $hMainGUI ExitLoop Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $hChildGUI GUISetState(@SW_ENABLE, $hMainGUI) GUISetState(@SW_HIDE, $hChildGUI) Case $msg[0] = $SwitchButton GUISetState(@SW_DISABLE, $hMainGUI) GUISetState(@SW_SHOW, $hChildGUI) Case $msg[0] = $SwitchButton1 GUISetState(@SW_ENABLE, $hMainGUI) GUISetState(@SW_HIDE, $hChildGUI) EndSelect WEnd It look good to have a simple code. Thank you so much Edited June 22, 2008 by luckyluke 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