Obtient la valeur définie par l'application associée à un élément
#include <GuiListBox.au3>
_GUICtrlListBox_GetItemData ( $hWnd, $iIndex )
$hWnd | ID/handle du contrôle |
$iIndex | Index de l'élément, compté à partir de 0 |
Succès: | Retourne la valeur définie pa l'application. |
Échec: | Retourne -1. |
#include <GUIConstantsEx.au3> #include <GuiListBox.au3> #include <MsgBoxConstants.au3> ; Warning this should not be used on items created using built-in functions ; Item data is the controlID for each string Example() Func Example() Local $idListBox ; Crée une GUI GUICreate("List Box Get Item Data", 400, 296) $idListBox = GUICtrlCreateList("", 2, 2, 396, 296) GUISetState(@SW_SHOW) ; Ajoute des chaînes _GUICtrlListBox_BeginUpdate($idListBox) For $iI = 1 To 9 _GUICtrlListBox_AddString($idListBox, StringFormat("%03d : Random string", Random(1, 100, 1))) Next _GUICtrlListBox_EndUpdate($idListBox) ; Définit ItemData _GUICtrlListBox_SetItemData($idListBox, 4, 1234) ; Obtient ItemData MsgBox($MB_SYSTEMMODAL, "Information", "Item 5 Data: " & _GUICtrlListBox_GetItemData($idListBox, 4)) ; Boucle jusqu'à ce que l'utilisateur quitte. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example