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

  1. #include <GUIConstants.au3>
  2. #include <GuiList.au3>
  3.  
  4. Opt('MustDeclareVars',1)
  5.  
  6. Dim $msg, $ret
  7. Dim $listbox,$button,$i,$button2,$button3
  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,$LBS_MULTIPLESEL))
  12. GUICtrlSetData($listbox,"test1|more testing|even more testing|demo|test2|test3|test4|test5|test6|test7|test8|test9|test10")
  13. $button = GUICtrlCreateButton("Toggle All",85,160,120,40)
  14. $button2 = GUICtrlCreateButton("Set index 3",215,160,120,40)
  15. $button3 = GUICtrlCreateButton("Toggle index 3",150,210,120,40)
  16.  
  17. GUISetState ()
  18. While 1
  19.     $msg = GUIGetMsg()
  20.     Select
  21.         Case $msg = $GUI_EVENT_CLOSE
  22.             ExitLoop
  23.         Case $msg = $button
  24.             $ret = _GUICtrlListSetSel($listbox)
  25.             If($ret == $LB_ERR) Then
  26.                 MsgBox(16,"Error","Unknown error from _GUICtrlListSetSel")
  27.             EndIf
  28.         Case $msg = $button2
  29.             $ret = _GUICtrlListSetSel($listbox,1,3)
  30.             If($ret == $LB_ERR) Then
  31.                 MsgBox(16,"Error","Unknown error from _GUICtrlListSetSel")
  32.             EndIf
  33.         Case $msg = $button3
  34.             $ret = _GUICtrlListSetSel($listbox,-1,3)
  35.             If($ret == $LB_ERR) Then
  36.                 MsgBox(16,"Error","Unknown error from _GUICtrlListSetSel")
  37.             EndIf
  38.     EndSelect
  39. Wend
  40.