Jump to content

Not able to select a value form combobox


Gokul
 Share

Recommended Posts

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 by Gokul
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

#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

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...