home *** CD-ROM | disk | FTP | other *** search
/ PCNET 2006 September - Disc 1 / PCNET_CD_2006_09.iso / shareware / autoit-v3-setup.exe / Examples / Helpfile / _GUICtrlListGetText.au3 < prev    next >
Encoding:
Text File  |  2006-06-17  |  745 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
  8.  
  9. GUICreate("ListBox Get Text Demo", 400, 250, -1, -1)
  10.  
  11. $listbox = GUICtrlCreateList("", 125, 40, 180, 120)
  12. GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|")
  13. $label = GUICtrlCreateLabel("Item #", 150, 210, 120)
  14.  
  15. GUISetState()
  16. While 1
  17.     $msg = GUIGetMsg()
  18.     Select
  19.         Case $msg = $GUI_EVENT_CLOSE
  20.             ExitLoop
  21.         Case $msg = $listbox
  22.             $ret = _GUICtrlListGetText ($listbox, _GUICtrlListSelectedIndex ($listbox))
  23.             If ($ret == $LB_ERR) Then
  24.                 MsgBox(16, "Error", "Unknown error from _GUICtrlListGetText")
  25.             Else
  26.                 GUICtrlSetData($label, "Item : " & $ret)
  27.             EndIf
  28.     EndSelect
  29. WEnd
  30.