autocomplex Posted September 14, 2007 Share Posted September 14, 2007 (edited) I am trying to get a script to work that allows the user to select which gui to display. It then hides the selection screen and displays the GUI, that the user has selected (ALL OF THIS WORKS ). However, when the user clicks a menu button to go back to the selection screen it supposed to hide the user-defined gui and once again display the selection gui, thus brining us back to the begining. expandcollapse popup#include <GUIConstants.au3> Global $selection = 0 ;ROOT GUI $SELECTGUI = GUICreate("", 301, 186, 359, 202) GUISetBkColor(0x000000) $AFRadio = GUICtrlCreateRadio("", 162, 130, 15, 15) $AFLabel = GUICtrlCreateLabel("Option 1", 177, 130, 95, 15) $NextButton = GUICtrlCreateButton(">> Next >>", 104, 160, 75, 17, 0) ;OPTION 1 GUI $AFGUI = GUICreate("AF", 266, 351, 359, 202) GUISetFont(8, 400, 0, "@Arial Unicode MS") GUISetBkColor(0x000000) $AFMenuFile = GUICtrlCreateMenu("&File") $AFMenuStart = GUICtrlCreateMenuItem("Start!", $AFMenuFile) $AFMenuStop = GUICtrlCreateMenuItem("Stop", $AFMenuFile) $AFSelection = GUICtrlCreateMenuItem("Selection Menu", $AFMenuFile) $AFMenuPreferences = GUICtrlCreateMenuItem("Preferences", $AFMenuFile) $AFMenuExit = GUICtrlCreateMenuItem("Exit", $AFMenuFile) ;MAIN LOOP While 1 Selection() BackToSelection() $msg = GUIGetMsg() Select Case $msg = $AFSelection BackToSelection() EndSelect Wend Func Selection() While $selection = 0 $msg = GUIGetMsg() Select Case $msg = $AFRadio $selection = 1 Case $msg = $PCRadio $selection = 2 Case $msg = $PFRadio $selection = 3 Case $msg = $HMRadio $selection = 4 Case $msg = $NextButton If $selection = 1 Then GUISetState(@SW_HIDE, $SELECTGUI) GUISetState(@SW_SHOW, $AFGUI) EndIf EndSelect Wend EndFunc Func BackToSelection() If $selection = 0 Then GUISetState(@SW_HIDE, $AFGUI) GUISetState(@SW_SHOW, $SELECTGUI) EndIf EndFunc I cant get it to close the OPTION 1 GUI and display the ROOT GUI again. Note, I know it says 4, but i shortened it to one for example purposes. Edited September 14, 2007 by inline853 Want Runescape Specific Scripts and Bots?Visit AutoIt Runescape Team (ARST) forum! Link to comment Share on other sites More sharing options...
BillLuvsU Posted September 14, 2007 Share Posted September 14, 2007 Well, I tried to run your example and got this: C:\Documents and Settings\Bill.FEARMOBILE\My Documents\scripts\randm crap\hfskudf.au3(54,29) : WARNING: $PCRadio: possibly used before declaration. Case $msg = $PCRadio~~~~~~~~~~~~~~~~~~~~~~~~~~~~^C:\Documents and Settings\Bill.FEARMOBILE\My Documents\scripts\randm crap\hfskudf.au3(57,29) : WARNING: $PFRadio: possibly used before declaration. Case $msg = $PFRadio~~~~~~~~~~~~~~~~~~~~~~~~~~~~^C:\Documents and Settings\Bill.FEARMOBILE\My Documents\scripts\randm crap\hfskudf.au3(60,29) : WARNING: $HMRadio: possibly used before declaration. Case $msg = $HMRadio~~~~~~~~~~~~~~~~~~~~~~~~~~~~^C:\Documents and Settings\Bill.FEARMOBILE\My Documents\scripts\randm crap\hfskudf.au3(54,29) : ERROR: $PCRadio: undeclared global variable. Case $msg = $PCRadio~~~~~~~~~~~~~~~~~~~~~~~~~~~~^C:\Documents and Settings\Bill.FEARMOBILE\My Documents\scripts\randm crap\hfskudf.au3 - 1 error(s), 3 warning(s)How about you post what you have, then maybe I can help you [center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw Link to comment Share on other sites More sharing options...
Uten Posted September 14, 2007 Share Posted September 14, 2007 GuiSwitch ? Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
BillLuvsU Posted September 14, 2007 Share Posted September 14, 2007 Of course Uten probly hit it right on the dot xD [center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw Link to comment Share on other sites More sharing options...
therks Posted September 15, 2007 Share Posted September 15, 2007 (edited) The challenge, such as it was, interested me, so I whipped this up. It's from scratch, I didn't use your example, but it might give you something to work from. expandcollapse popup#include <GUIConstants.au3> $gui_Select = GUICreate('Select', 110, 120) $ra_One = GUICtrlCreateRadio('GUI One', 5, 5, 100, 20) $ra_Two = GUICtrlCreateRadio('GUI Two', 5, 25, 100, 20) $ra_Three = GUICtrlCreateRadio('GUI Three', 5, 45, 100, 20) $ra_Four = GUICtrlCreateRadio('GUI Four', 5, 65, 100, 20) $bt_Go = GUICtrlCreateButton('Go', 5, 90, 100, 25) $gui_One = GUICreate('One', 100, 100) $gui_Two = GUICreate('Two', 200, 100) $gui_Three = GUICreate('Three', 300, 100) $gui_Four = GUICreate('Four', 400, 100) $hSelectGUI = _Select() GUISetState(@SW_SHOW, $hSelectGUI) While 1 $gm = GUIGetMsg(1) ; We're going to use advanced mode to keep track of the separate GUI's Switch $gm[0] Case $GUI_EVENT_CLOSE GUISetState(@SW_HIDE, $gm[1]) ; $gm[1] is a handle to the window that caused the event $hSelectGUI = _Select() GUISetState(@SW_SHOW, $hSelectGUI) EndSwitch WEnd Func _Select() Local $hSelect GUISetState(@SW_SHOW, $gui_Select) While 1 $gm = GUIGetMsg() Switch $gm Case $ra_One $hSelect = $gui_One Case $ra_Two $hSelect = $gui_Two Case $ra_Three $hSelect = $gui_Three Case $ra_Four $hSelect = $gui_Four Case $bt_Go If $hSelect Then ExitLoop Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd GUISetState(@SW_HIDE, $gui_Select) Return $hSelect EndFunc *Edit: Oops, small tweak. Edited September 15, 2007 by Saunders My AutoIt Stuff | My Github 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