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

  1. #include <GUIConstants.au3>
  2. #include <GuiList.au3>
  3.  
  4. Opt ('MustDeclareVars', 1)
  5.  
  6. Dim $msg, $ret
  7. Dim $listbox, $label, $button
  8.  
  9. GUICreate("ListBox Set Caret Index Demo", 400, 250, -1, -1)
  10.  
  11. $listbox = GUICtrlCreateList("", 125, 40, 180, 120, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_MULTIPLESEL))
  12. GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|")
  13. $button = GUICtrlCreateButton("Set Index", 150, 160, 120, 40)
  14. $label = GUICtrlCreateLabel("Item #", 150, 210, 120)
  15. $ret = _GUICtrlListGetCaretIndex ($listbox)
  16. GUICtrlSetData($label, "Item : " & $ret)
  17.  
  18. GUISetState()
  19. While 1
  20.     $msg = GUIGetMsg()
  21.     Select
  22.         Case $msg = $GUI_EVENT_CLOSE
  23.             ExitLoop
  24.         Case $msg = $button
  25.             $ret = _GUICtrlListSetCaretIndex ($listbox, 3, 1)
  26.             $ret = _GUICtrlListGetCaretIndex ($listbox)
  27.             GUICtrlSetData($label, "Item : " & $ret)
  28.     EndSelect
  29. WEnd
  30.