home *** CD-ROM | disk | FTP | other *** search
/ PCNET 2006 September - Disc 1 / PCNET_CD_2006_09.iso / shareware / autoit-v3-setup.exe / Examples / Helpfile / _GUICtrlListGetSelItems.au3 < prev    next >
Encoding:
Text File  |  2006-06-17  |  840 b   |  28 lines

  1. #include <GUIConstants.au3>
  2. #include <GuiList.au3>
  3.  
  4. Opt ('MustDeclareVars', 1)
  5.  
  6. Dim $msg, $ret, $listbox, $button, $i
  7.  
  8. GUICreate("ListBox Selected Items Indices Demo", 400, 250, -1, -1)
  9. $listbox = GUICtrlCreateList("", 125, 40, 180, 120, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_MULTIPLESEL))
  10. GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|")
  11. $button = GUICtrlCreateButton("Get Selected", 150, 160, 120, 40)
  12. GUISetState()
  13. While 1
  14.     $msg = GUIGetMsg()
  15.     Select
  16.         Case $msg = $GUI_EVENT_CLOSE
  17.             ExitLoop
  18.         Case $msg = $button
  19.             $ret = _GUICtrlListGetSelItems ($listbox)
  20.             If (Not IsArray($ret)) Then
  21.                 MsgBox(16, "Error", "Unknown error from _GUICtrlListGetSelItems")
  22.             Else
  23.                 For $i = 1 To $ret[0]
  24.                     MsgBox(0, "Selected", $ret[$i])
  25.                 Next
  26.             EndIf
  27.     EndSelect
  28. WEnd