sumit Posted August 16, 2007 Share Posted August 16, 2007 Please run this code . As you can see when selecting the item in first Gui ..... You get second Gui, Now my problem is when i Close the second Gui either by selecting cancel or close button I should be able to get back to first Gui ....... What should I do . Also when i click Close button ( X sign ) in 2nd window it doesnt close the first time .... it closes on 2nd click..... why is that happening. Any help would be appreciated. CODE#include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form2 = GUICreate("Dias Configuration", 368, 141, 321, 254) $GroupBox2 = GUICtrlCreateGroup("", 8, 1, 265, 129) $List2 = GUICtrlCreateList("", 32, 32, 217, 58) GUICtrlSetData($List2, 'Control Card') GUICtrlCreateGroup("", -99, -99, 1, 1) $2Button1 = GUICtrlCreateButton("&OK", 286, 11, 75, 25, 0) $2Button2 = GUICtrlCreateButton("&Cancel", 285, 44, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Do $mMsg = GUIGetMsg() If $mMsg = $2Button1 Then $H = GUICtrlRead($List2) If $H = "Control Card" Then #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Control Card", 368, 141, 321, 254) $GroupBox1 = GUICtrlCreateGroup("", 8, 1, 265, 129) $List1 = GUICtrlCreateList("", 32, 32, 217, 58) GUICtrlSetData($List1, 'Login') GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("&OK", 286, 11, 75, 25, 0) $Button2 = GUICtrlCreateButton("&Cancel", 285, 44, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Do $nMsg = GUIGetMsg() If $nMsg = $Button1 Then $G = GUICtrlRead($List1) If $G = "Login" Then ; Do Something EndIf EndIf If $nMsg = $Button2 Then ; Here I want to Close this Gui and Restore First Gui Exit EndIf Until $nMsg = $Gui_Event_Close () ; Here also I want to Close this Gui and Restore First Gui EndIf EndIf if $mMsg = $2Button2 Then Exit Endif Until $mMsg = $Gui_Event_Close () Link to comment Share on other sites More sharing options...
James Posted August 16, 2007 Share Posted August 16, 2007 GUIDelete("2nd GUI") Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
sumit Posted August 16, 2007 Author Share Posted August 16, 2007 (edited) GUIDelete("2nd GUI") Ok with your advice Im able to get back to first GUI on clicking cancel in 2nd GUI Heres the modified code CODEexpandcollapse popup #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form2 = GUICreate("Dias Configuration", 368, 141, 321, 254) $GroupBox2 = GUICtrlCreateGroup("", 8, 1, 265, 129) $List2 = GUICtrlCreateList("", 32, 32, 217, 58) GUICtrlSetData($List2, 'Control Card') GUICtrlCreateGroup("", -99, -99, 1, 1) $2Button1 = GUICtrlCreateButton("&OK", 286, 11, 75, 25, 0) $2Button2 = GUICtrlCreateButton("&Cancel", 285, 44, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Do $mMsg = GUIGetMsg() If $mMsg = $2Button1 Then $H = GUICtrlRead($List2) If $H = "Control Card" Then #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Control Card", 368, 141, 321, 254) $GroupBox1 = GUICtrlCreateGroup("", 8, 1, 265, 129) $List1 = GUICtrlCreateList("", 32, 32, 217, 58) GUICtrlSetData($List1, 'Login') GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("&OK", 286, 11, 75, 25, 0) $Button2 = GUICtrlCreateButton("&Cancel", 285, 44, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Do $nMsg = GUIGetMsg() If $nMsg = $Button1 Then $G = GUICtrlRead($List1) If $G = "Login" Then ; Do Something EndIf EndIf If $nMsg = $Button2 Then GUIDelete($Form1) GUISetState($Form2,@SW_RESTORE) EndIf Until $nMsg = $Gui_Event_Close () ; Here also I want to Close this Gui and Restore First Gui EndIf EndIf if $mMsg = $2Button2 Then Exit Endif Until $mMsg = $Gui_Event_Close () [\code] but i still have 2 problems 1. After getting back to first Gui Im not able to go to 2nd gui again 2. ON pressing the X button in 2nd gui i dont reach first GUI Edited August 16, 2007 by sumit Link to comment Share on other sites More sharing options... Developers Jos Posted August 16, 2007 Jos Developers 34.3k 156 Je maintiendrai Developers Share Posted August 16, 2007 #Region ### START Koda GUI section ### Form= #Include<GuiConstants.au3> $Form2 = GUICreate("Dias Configuration", 368, 141, 321, 254) $GroupBox2 = GUICtrlCreateGroup("", 8, 1, 265, 129) $List2 = GUICtrlCreateList("", 32, 32, 217, 58) GUICtrlSetData($List2, 'Control Card') GUICtrlCreateGroup("", -99, -99, 1, 1) $2Button1 = GUICtrlCreateButton("&OK", 286, 11, 75, 25, 0) $2Button2 = GUICtrlCreateButton("&Cancel", 285, 44, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Do $mMsg = GUIGetMsg() If $mMsg = $2Button1 Then $H = GUICtrlRead($List2) If $H = "Control Card" Then #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Control Card", 368, 141, 321, 254) $GroupBox1 = GUICtrlCreateGroup("", 8, 1, 265, 129) $List1 = GUICtrlCreateList("", 32, 32, 217, 58) GUICtrlSetData($List1, 'Login') GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("&OK", 286, 11, 75, 25, 0) $Button2 = GUICtrlCreateButton("&Cancel", 285, 44, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Do $nMsg = GUIGetMsg() If $nMsg = $Button1 Then $G = GUICtrlRead($List1) If $G = "Login" Then ; Do Something EndIf EndIf If $nMsg = $Button2 Then ExitLoop EndIf Until $nMsg = $Gui_Event_Close; Here also I want to Close this Gui and Restore First Gui GUIDelete($Form1) GUISetState($Form2, @SW_RESTORE) EndIf EndIf If $mMsg = $2Button2 Then Exit EndIf Until $mMsg = $Gui_Event_Close () SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
sumit Posted August 16, 2007 Author Share Posted August 16, 2007 expandcollapse popup#Region ### START Koda GUI section ### Form= #Include<GuiConstants.au3> $Form2 = GUICreate("Dias Configuration", 368, 141, 321, 254) $GroupBox2 = GUICtrlCreateGroup("", 8, 1, 265, 129) $List2 = GUICtrlCreateList("", 32, 32, 217, 58) GUICtrlSetData($List2, 'Control Card') GUICtrlCreateGroup("", -99, -99, 1, 1) $2Button1 = GUICtrlCreateButton("&OK", 286, 11, 75, 25, 0) $2Button2 = GUICtrlCreateButton("&Cancel", 285, 44, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Do $mMsg = GUIGetMsg() If $mMsg = $2Button1 Then $H = GUICtrlRead($List2) If $H = "Control Card" Then #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Control Card", 368, 141, 321, 254) $GroupBox1 = GUICtrlCreateGroup("", 8, 1, 265, 129) $List1 = GUICtrlCreateList("", 32, 32, 217, 58) GUICtrlSetData($List1, 'Login') GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("&OK", 286, 11, 75, 25, 0) $Button2 = GUICtrlCreateButton("&Cancel", 285, 44, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Do $nMsg = GUIGetMsg() If $nMsg = $Button1 Then $G = GUICtrlRead($List1) If $G = "Login" Then ; Do Something EndIf EndIf If $nMsg = $Button2 Then ExitLoop EndIf Until $nMsg = $Gui_Event_Close; Here also I want to Close this Gui and Restore First Gui GUIDelete($Form1) GUISetState($Form2, @SW_RESTORE) EndIf EndIf If $mMsg = $2Button2 Then Exit EndIf Until $mMsg = $Gui_Event_Close () A reply from the Moderator ..... The solution had to be perfect............ thanks a lot 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