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

  1. #include <GUIConstants.au3>
  2. #include <GuiList.au3>
  3.  
  4. opt('MustDeclareVars', 1)
  5.  
  6. Dim $msg, $ret
  7. Dim $listbox, $button, $button2
  8.  
  9. GUICreate("ListBox Set Selection(s) Demo", 400, 250, -1, -1)
  10.  
  11. $listbox = GUICtrlCreateList("", 125, 40, 180, 120, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY))
  12. GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|test2|test3|test4|test5|test6|test7|test8|test9|test10")
  13. $button = GUICtrlCreateButton("Set index 3", 160, 160, 120, 40)
  14. $button2 = GUICtrlCreateButton("Set index 12", 160, 210, 120, 40)
  15.  
  16. GUISetState()
  17. While 1
  18.     $msg = GUIGetMsg()
  19.     Select
  20.         Case $msg = $GUI_EVENT_CLOSE
  21.             ExitLoop
  22.         Case $msg = $button
  23.             $ret = _GUICtrlListSelectIndex ($listbox, 3)
  24.             If ($ret == $LB_ERR) Then
  25.                 MsgBox(16, "Error", "Unknown error from _GUICtrlListSelectIndex")
  26.             EndIf
  27.         Case $msg = $button2
  28.             $ret = _GUICtrlListSelectIndex ($listbox, 12)
  29.             If ($ret == $LB_ERR) Then
  30.                 MsgBox(16, "Error", "Unknown error from _GUICtrlListSelectIndex")
  31.             EndIf
  32.     EndSelect
  33. WEnd
  34.