psgame_freak Posted August 3, 2006 Share Posted August 3, 2006 If so, can I get a sample please. I want to control my program depending on what option was selected on the combo box. And that's all I need the GUI for. So basically: 1) Program starts with combo box 2) User selects an option 3) program starts according to option chosen on combo box. 4) The GUI sits there in case user wants to change his option. Link to comment Share on other sites More sharing options...
xcal Posted August 3, 2006 Share Posted August 3, 2006 I think you want something like this? #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) GUICreate("Combo Test", 120, 80) GUISetOnEvent($GUI_EVENT_CLOSE, "close") GUISetState(@SW_SHOW) $combo = GUICtrlCreateCombo("", 30, 30, 60, 20) GUICtrlSetOnEvent($combo, "check") GUICtrlSetData($combo, "One|Two|Three", "One") Func check() $item = GUICtrlRead($combo) Select Case $item = "One" MsgBox(0, "", "This is One") Case $item = "Two" MsgBox(0, "", "This is Two") Case $item = "Three" MsgBox(0, "", "This is Three") EndSelect EndFunc Func close() Exit EndFunc While 1 Sleep(1000) WEnd How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
psgame_freak Posted August 3, 2006 Author Share Posted August 3, 2006 I think you want something like this? #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) GUICreate("Combo Test", 120, 80) GUISetOnEvent($GUI_EVENT_CLOSE, "close") GUISetState(@SW_SHOW) $combo = GUICtrlCreateCombo("", 30, 30, 60, 20) GUICtrlSetOnEvent($combo, "check") GUICtrlSetData($combo, "One|Two|Three", "One") Func check() $item = GUICtrlRead($combo) Select Case $item = "One" MsgBox(0, "", "This is One") Case $item = "Two" MsgBox(0, "", "This is Two") Case $item = "Three" MsgBox(0, "", "This is Three") EndSelect EndFunc Func close() Exit EndFunc While 1 Sleep(1000) WEnd Yes! Thank you. One big problem though. My code looks exactly like yours now but I get error "Select" statement is missing "EndSelect" or "Case" statement. Is there a limit on how many cases are there? Because I have 21. And does it matter where everything is? Like, do function need to be above the infinite loop? Link to comment Share on other sites More sharing options...
xcal Posted August 3, 2006 Share Posted August 3, 2006 (edited) I don't know about a limit with Select, but I'm sure it wouldn't be as low as 21. I'd think it's an error in your script. The order of certain things does matter. I've noticed the loop can be before personally created functions, but not before external functions and items like guicreate... It's easy enough just to make it last. I'm actually brandnew to Autoit, so I may be wrong. I've started picking it up pretty quick, though, because of the amazing help file. Edited August 3, 2006 by xcal How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
psgame_freak Posted August 3, 2006 Author Share Posted August 3, 2006 I know what I did wrong. Don't name a variable select if you're going to use it inside While...WEnd 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