PantZ4 Posted October 2, 2007 Share Posted October 2, 2007 Alright I need to pick something out of a combo box and so far I have figured out to drop the combo box down, but I can't see anything about selection a option. I can see a WinMenuSelectItem but of what I can read it only works for file menu. Thanks in advance. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 2, 2007 Moderators Share Posted October 2, 2007 Alright I need to pick something out of a combo box and so far I have figured out to drop the combo box down, but I can't see anything about selection a option.I can see a WinMenuSelectItem but of what I can read it only works for file menu.Thanks in advance.ControlCommand Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Blue_Drache Posted October 2, 2007 Share Posted October 2, 2007 Alright I need to pick something out of a combo box and so far I have figured out to drop the combo box down, but I can't see anything about selection a option.I can see a WinMenuSelectItem but of what I can read it only works for file menu.Thanks in advance.ControlCommand() ControlSetText() Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
GaryFrost Posted October 2, 2007 Share Posted October 2, 2007 (edited) or look at combobox udfs and ControlGetHandle in the latest beta Edited October 2, 2007 by GaryFrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
PantZ4 Posted October 2, 2007 Author Share Posted October 2, 2007 Total missed SetCurrentSelection <.< Thanks. Link to comment Share on other sites More sharing options...
wolf9228 Posted October 2, 2007 Share Posted October 2, 2007 (edited) Alright I need to pick something out of a combo box and so far I have figured out to drop the combo box down, but I can't see anything about selection a option. I can see a WinMenuSelectItem but of what I can read it only works for file menu. Thanks in advance. #include <GUIConstants.au3> GUICreate("My GUI combo") $combx = GUICtrlCreateCombo ("", 10,10) $data = "item1|item2|item3" GUICtrlSetData($combx,$data,"item3") $Button1 = GUICtrlCreateButton ( "SelectString item1", 250, 50 ,100,30) $Button2 = GUICtrlCreateButton ( "SelectString item2", 250, 90 ,100,30) $Button3 = GUICtrlCreateButton ( "SelectString item3", 250, 130 ,100,30) GUISetState () While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $combx MsgBox(0, "", "ControlCommand-SelectString ===> " & GUICtrlRead($combx) , 3) Case $msg = $Button1 $var = ControlGetText("My GUI combo", "", $combx) ControlFocus("My GUI combo",$var, $combx) ControlCommand ( "My GUI combo", $var, $combx, "SelectString" , "item1") Case $msg = $Button2 $var = ControlGetText("My GUI combo", "", $combx) ControlFocus("My GUI combo",$var, $combx) ControlCommand ( "My GUI combo", $var, $combx, "SelectString" , "item2") Case $msg = $Button3 $var = ControlGetText("My GUI combo", "", $combx) ControlFocus("My GUI combo",$var, $combx) ControlCommand ( "My GUI combo", $var, $combx, "SelectString" , "item3") EndSelect Wend Edited October 2, 2007 by wolf9228 صرح السماء كان هنا Link to comment Share on other sites More sharing options...
wolf9228 Posted October 2, 2007 Share Posted October 2, 2007 or #include <GUIConstants.au3> GUICreate("My GUI combo") $combx = GUICtrlCreateCombo ("", 10,10) $data = "item1|item2|item3" GUICtrlSetData($combx,$data,"item3") $Button1 = GUICtrlCreateButton ( "SelectString item1", 250, 50 ,100,30) $Button2 = GUICtrlCreateButton ( "SelectString item2", 250, 90 ,100,30) $Button3 = GUICtrlCreateButton ( "SelectString item3", 250, 130 ,100,30) GUISetState () While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $combx MsgBox(0, "", "SelectString ===> " & GUICtrlRead($combx) , 3) Case $msg = $Button1 $var = ControlGetText("My GUI combo", "", $combx) ControlFocus("My GUI combo",$var, $combx) GUICtrlSetData($combx,$data,"item1") Case $msg = $Button2 $var = ControlGetText("My GUI combo", "", $combx) ControlFocus("My GUI combo",$var, $combx) GUICtrlSetData($combx,$data,"item2") Case $msg = $Button3 $var = ControlGetText("My GUI combo", "", $combx) ControlFocus("My GUI combo",$var, $combx) GUICtrlSetData($combx,$data,"item3") EndSelect Wend صرح السماء كان هنا Link to comment Share on other sites More sharing options...
GaryFrost Posted October 2, 2007 Share Posted October 2, 2007 (edited) beta expandcollapse popup#include <GuiConstants.au3> #include <GUIComboBox.au3> Opt('MustDeclareVars', 1) $Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work Global $hCombo Example_Internal() Example_External() Func Example_Internal() Local $hGUI ; Create GUI $hGUI = GUICreate("(Internal) ComboBox Get Cur Sel", 400, 296) $hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296) GUISetState() ; Add files _GUICtrlComboBox_BeginUpdate ($hCombo) _GUICtrlComboBox_AddDir ($hCombo, @WindowsDir & "\*.exe") _GUICtrlComboBox_EndUpdate ($hCombo) ; Select Item _GUICtrlComboBox_SetCurSel ($hCombo, 2) ; Get Cur Sel MsgBox(4160, "Information", "Cur Sel: " & _GUICtrlComboBox_GetCurSel ($hCombo)) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example_Internal Func Example_External() Local $hGUI ; Create GUI $hGUI = GUICreate("(External) ComboBox Get Cur Sel", 400, 296) $hCombo = _GUICtrlComboBox_Create ($hGUI, "", 2, 2, 396, 296) GUISetState() ; Add files _GUICtrlComboBox_BeginUpdate ($hCombo) _GUICtrlComboBox_AddDir ($hCombo, @WindowsDir & "\*.exe") _GUICtrlComboBox_EndUpdate ($hCombo) ; Select Item _GUICtrlComboBox_SetCurSel ($hCombo, 2) ; Get Cur Sel MsgBox(4160, "Information", "Cur Sel: " & _GUICtrlComboBox_GetCurSel ($hCombo)) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example_External look up _GUICtrlComboBox_GetLBText to get the text of any item by index Edited October 2, 2007 by GaryFrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
GaryFrost Posted October 2, 2007 Share Posted October 2, 2007 beta with icons expandcollapse popup#include <GuiConstants.au3> #include <GuiComboBoxEx.au3> #include <GuiImageList.au3> Opt('MustDeclareVars', 1) $Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work Global $hCombo _Main() Func _Main() Local $hGUI, $hImage ; Create GUI $hGUI = GUICreate("ComboBoxEx Get Cur Sel", 400, 300) $hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100, BitOR($CBS_SIMPLE, $WS_VSCROLL, $WS_BORDER)) GUISetState() $hImage = _GUIImageList_Create (16, 16, 5, 3) _GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110) _GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131) _GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165) _GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168) _GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137) _GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146) _GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16)) _GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16)) _GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16)) _GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage) _GUICtrlComboBoxEx_InitStorage ($hCombo, 150, 300) _GUICtrlComboBoxEx_BeginUpdate ($hCombo) For $x = 0 To 149 _GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), Random(0, 8, 1), Random(0, 8, 1), Random(0, 8, 1)) Next _GUICtrlComboBoxEx_EndUpdate ($hCombo) ; Set Cur Sel _GUICtrlComboBoxEx_SetCurSel ($hCombo, Random(0, 149, 1)) ; Get Cur Sel MsgBox(4160, "Information", "Current Sel: " & _GUICtrlComboBoxEx_GetCurSel ($hCombo)) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>_Main look up _GUICtrlComboBoxEx_GetItemText to get text of any given index SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. 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