Fügt einen String hinzu
#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_AddString($hWnd, $sText[, $iImage = -1[, $iSelecteImage = -1[, $iOverlayImage = -1[, $iIndent = -1[, $iParam = -1]]]]])
Parameter
| $hWnd | Handle des Controls |
| $sText | Itemtext. Falls auf -1 gesetzt, wird das Item durch die $CBEN_GETDISPINFO Nachricht gesetzt. |
| $iImage | [optional] 0-basierender Index des Icons des Items in der Imagelist des Controls |
| $iSelecteImage | [optional] 0-basierender Index des Icons des Items in der Imagelist des Controls |
| $iOverlayImage | [optional] 0-basierender Index des Icons des Items in der Imagelist des Controls |
| $iIndent | [optional] Anzahl von Bilderbreiten um die das Item eingerückt werden soll. Eine einfache Einrückung entspricht eine Breites eines Bildes. |
| $iParam | [optional] Wert der das Item festlegt |
Rückgabewert
| Erfolg: | Der Index des neuen Items |
| Fehler: | -1 |
Bemerkungen
- - - - - - - - Erklärung der Controls - - - - - - - -
Verwandte Funktionen
_GUICtrlComboBoxEx_DeleteString, _GUICtrlComboBoxEx_InitStorage
Beispiel
#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>
Opt('MustDeclareVars', 1)
$Debug_CB = False ; Prüft den Klassennamen (ClassName), der an die ComboBox/ComboBoxEx-Funktion übergeben wird. Setze dies versuchsweise auf True und verwende dann ein Handle zu einem anderen Control, um die Funktionsweise zu verstehen.
_Main()
Func _Main()
Local $hGUI, $hImage, $hCombo
; Erstellt eine GUI
$hGUI = GUICreate("ComboBoxEx: String hinzufügen", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()
$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 : ZufallsString", Random(1, 200, 1)), $x, $x)
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main