Function Reference


_GUICtrlComboBoxEx_InsertString

Inserts a new item in the control

#include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_InsertString ( $hWnd, $sText [, $iIndex = -1 [, $iImage = -1 [, $iSelectedImage = -1 [, $iOverlayImage = -1 [, $iIndent = -1 [, $iParam = -1]]]]]] )

Parameters

$hWnd Handle to the control
$sText Item text. If set to -1, the item set is set via the $CBEN_GETDISPINFO notification message.
$iIndex [optional] 0-based index at which the new string should be inserted.
To insert an item at the end of the list, set the $iIndex member to -1
$iImage [optional] 0-based index of the item's icon in the control's image list
$iSelectedImage [optional] 0-based index of the item's icon in the control's image list
$iOverlayImage [optional] 0-based index of the item's icon in the control's image list
$iIndent [optional] Number of image widths to indent the item. A single indentation equals the width of an image.
$iParam [optional] Value specific to the item

Return Value

Success: the index of the new item.
Failure: -1.

Related

_GUICtrlComboBoxEx_InitStorage

Example

#include <GuiComboBoxEx.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
        ; Create GUI
        Local $hGUI = GUICreate("ComboBoxEx Insert String (v" & @AutoItVersion & ")", 400, 300)
        Local $hCombo = _GUICtrlComboBoxEx_Create($hGUI, "", 2, 2, 394, 100)
        GUISetState(@SW_SHOW)

        ; Add files
        _GUICtrlComboBoxEx_BeginUpdate($hCombo)
        _GUICtrlComboBoxEx_AddDir($hCombo, "", $DDL_DRIVES, False)
        _GUICtrlComboBoxEx_AddDir($hCombo, "", $DDL_DRIVES)
        _GUICtrlComboBoxEx_BeginUpdate($hCombo)
        _GUICtrlComboBoxEx_AddDir($hCombo, @WindowsDir & "\*.exe")
        _GUICtrlComboBoxEx_EndUpdate($hCombo)
        _GUICtrlComboBoxEx_EndUpdate($hCombo)

        ; Insert string
        _GUICtrlComboBoxEx_InsertString($hCombo, "Text inserted", 1)

        ; show drop down
        _GUICtrlComboBoxEx_ShowDropDown($hCombo, True)

        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>Example