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

  1. #include <GuiConstants.au3>
  2. #include <GuiListView.au3>
  3.  
  4. Opt ('MustDeclareVars', 1)
  5. Dim $listview, $Btn_GetAbove, $Btn_GetBelow, $Btn_Exit, $msg, $Status, $GUI
  6. $GUI = GUICreate("ListView Get Next Item", 392, 322)
  7.  
  8. $listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
  9. GUICtrlCreateListViewItem("line1|data1|more1", $listview)
  10. GUICtrlCreateListViewItem("line2|data2|more2", $listview)
  11. GUICtrlCreateListViewItem("line3|data3|more3", $listview)
  12. GUICtrlCreateListViewItem("line4|data4|more4", $listview)
  13. GUICtrlCreateListViewItem("line5|data5|more5", $listview)
  14. $Btn_GetAbove = GUICtrlCreateButton("Get Next Above", 75, 200, 90, 40)
  15. $Btn_GetBelow = GUICtrlCreateButton("Get Next Below", 200, 200, 90, 40)
  16. $Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
  17. $Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
  18.  
  19. GUISetState()
  20. While 1
  21.     $msg = GUIGetMsg()
  22.     Select
  23.         Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
  24.             ExitLoop
  25.         Case $msg = $Btn_GetAbove
  26.             GUICtrlSetData($Status, "")
  27.             If (_GUICtrlListViewGetCurSel ($listview) > 0) Then
  28.                 GUICtrlSetData($Status, "Next Above Index: " & _GUICtrlListViewGetNextItem ($GUI, $listview, _GUICtrlListViewGetCurSel ($listview), $LVNI_ABOVE))
  29.             Else
  30.                 GUICtrlSetData($Status, "Nothing Selected or Nothing Above")
  31.             EndIf
  32.         Case $msg = $Btn_GetBelow
  33.             GUICtrlSetData($Status, "")
  34.             If (_GUICtrlListViewGetCurSel ($listview) > $LV_ERR And _GUICtrlListViewGetCurSel ($listview) < _GUICtrlListViewGetItemCount ($listview) -1) Then
  35.                 GUICtrlSetData($Status, "Next Below Index: " & _GUICtrlListViewGetNextItem ($GUI, $listview, _GUICtrlListViewGetCurSel ($listview), $LVNI_BELOW))
  36.             Else
  37.                 GUICtrlSetData($Status, "Nothing Selected or Nothing Below")
  38.             EndIf
  39.     EndSelect
  40. WEnd
  41. Exit
  42.