gigilihooie Posted December 14, 2008 Share Posted December 14, 2008 So, I want to have a combobox with a list of things in it. You click one of the things and it will do something (below is an example which I cant get to work). #include <GUIConstantsEx.au3> GUICreate("My GUI combo") $go = GUICtrlCreateButton("ok", 10, 100, 155, 17, 0) $ok = GUICtrlCreateCombo("1", 10, 10) GUICtrlSetData(-1, "2") GUISetState() While 1 $msg = GUIGetMsg() select Case $go If $ok =1 Then Exit If $ok =2 Then Exit If $msg = $GUI_EVENT_CLOSE Then Exit EndSelect WEnd Link to comment Share on other sites More sharing options...
ResNullius Posted December 14, 2008 Share Posted December 14, 2008 (edited) You have to GuiCtrlRead to get the data from the combo:#include <GUIConstantsEx.au3> GUICreate("My GUI combo") $go = GUICtrlCreateButton("ok", 10, 100, 155, 17, 0) $ok = GUICtrlCreateCombo("1", 10, 10) GUICtrlSetData(-1, "2") GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $go If GUICtrlRead($ok) = 1 Then MsgBox(0, "", "1") If GUICtrlRead($ok) = 2 Then MsgBox(0, "", "2") Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEndAlso fixed the way you were trying to capture the Gui_Event_CloseEdit: This would also be a good place to use a Switch instead of Select:#include <GUIConstantsEx.au3> GUICreate("My GUI combo") $go = GUICtrlCreateButton("ok", 10, 100, 155, 17, 0) $ok = GUICtrlCreateCombo("1", 10, 10) GUICtrlSetData(-1, "2") GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $go If GUICtrlRead($ok) = 1 Then MsgBox(0, "", "1") If GUICtrlRead($ok) = 2 Then MsgBox(0, "", "2") Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Edited December 14, 2008 by ResNullius 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