Gokul Posted January 27, 2014 Posted January 27, 2014 (edited) Hi, My application have a combobox with values 'Test', 'Test1' and 'Test3' in it. But, when i give the below script the dropdown list is shown but 'Test1' is not selected from the dropdown list of the combobox. ControlCommand("Title", "", "[NAME:controlname]", "ShowDropDown") ControlCommand("Title", "", "[NAME:controlname]", "SelectString", 'Test1') How to select and set a value from the dropdown list to combobox. Edited January 27, 2014 by Gokul
l3ill Posted January 27, 2014 Posted January 27, 2014 Gokul, Not really clear on what your going for... If this is your own GUI you dont need ControlCommand to select & manipulate items rather something like: _GUICtrlComboBox_SetEditSel etc... Bill My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
Gokul Posted January 28, 2014 Author Posted January 28, 2014 Gokul, Not really clear on what your going for... If this is your own GUI you dont need ControlCommand to select & manipulate items rather something like: _GUICtrlComboBox_SetEditSel etc... Bill Iam new to Autoit. Can you give me a sample code on how to use _GUICtrlCombobox_SetEditSel.
hotkeySet Posted January 28, 2014 Posted January 28, 2014 expandcollapse popup#include <GuiComboBox.au3> #include <GUIConstantsEx.au3> $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 $iMemo _Main() Func _Main() Local $aSel, $hCombo ; Create GUI GUICreate("ComboBox Set Edit Sel", 400, 296) $hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296) $iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0) GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New") GUISetState() ; Add files _GUICtrlComboBox_BeginUpdate($hCombo) _GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe") _GUICtrlComboBox_EndUpdate($hCombo) ; Select Item _GUICtrlComboBox_SetCurSel($hCombo, 2) ; Set Edit Sel _GUICtrlComboBox_SetEditSel($hCombo, 0, 4) ; Get Edit Sel $aSel = _GUICtrlComboBox_GetEditSel($hCombo) MemoWrite(StringFormat("Edit Sel: %d - %d", $aSel[0], $aSel[1])) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main ; Write a line to the memo control Func MemoWrite($sMessage) GUICtrlSetData($iMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite
hotkeySet Posted January 28, 2014 Posted January 28, 2014 Autoit help is user friendly. try it out i am also new to autoit
Automationuser Posted January 28, 2014 Posted January 28, 2014 Try using $hWnd=ControlGetHandle("Title", "", "[NAME:controlname]") _GUICtrlComboBox_SelectString($hWnd, "Test1") And also looks like the dropdown item "Test1" is not specified properly in your first post. "Test1" should be put inside double quotes not single. ControlCommand("Title", "", "[NAME:controlname]", "SelectString", "Test1")
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