Add a string
#include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_AddString ( $hWnd, $sText [, $iImage = -1 [, $iSelectedImage = -1 [, $iOverlayImage = -1 [, $iIndent = -1 [, $iParam = -1]]]]] )
$hWnd | Handle to the control |
$sText | Item text. If set to -1, the item set is set via the $CBEN_GETDISPINFO notification message. |
$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 |
Success: | the index of the new item. |
Failure: | -1. |
_GUICtrlComboBoxEx_DeleteString, _GUICtrlComboBoxEx_InitStorage
#include <GuiComboBoxEx.au3>
#include <GUIConstantsEx.au3>
#include <GuiImageList.au3>
Example()
Func Example()
Local $hGUI, $hImage, $hCombo
; Create GUI
$hGUI = GUICreate("ComboBoxEx Add String", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create($hGUI, "", 2, 2, 394, 100)
GUISetState(@SW_SHOW)
$hImage = _GUIImageList_Create(16, 16, 5, 3)
For $x = 0 To 146
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", $x)
Next
_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, 200, 1)), $x, $x)
Next
_GUICtrlComboBoxEx_EndUpdate($hCombo)
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>Example