aakira Posted August 31, 2009 Posted August 31, 2009 Hello, I show a bunch of data from an array in a listview element. Now I want to get the item a user highlitet/clicked: $view= GUICtrlCreateListView("Document | Size | Date | Time | Author" , 16, 80, 520, 305) _GUICtrlListView_SetColumnWidth($view, 0, 230) $item = GUICtrlCreateListViewItem($IArray[$i][0] & "|" & $IArray[$i][2] & "|" & $MyDate & "|" & $MyTime & "|" & $IArray[$i][4],$view) GUICtrlSetOnEvent(-1, 'clicked') Func clicked() MsgBox(0, "listview", "clicked=" & GUICtrlRead($view), 2) EndFunc
furrycow Posted August 31, 2009 Posted August 31, 2009 (edited) Ok, i got very confused with what you were writing, and you havent given me all the code needed, so i just wrote a simple example of what you need, so you will have to apply it to your situation! #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> Opt("GUIOnEventMode",1) $Form1 = GUICreate("Form1", 398, 245, 193, 125) $view = GUICtrlCreateListView("Item Number", 8, 8, 289, 225) GUICtrlSetOnEvent($view,"view") GUISetState() For $i=0 To 10 GUICtrlCreateListViewItem ($i, $view ) GUICtrlSetOnEvent(-1,"view") Next While 1 Sleep(100) WEnd Func view() For $i = 0 To _GUICtrlListView_GetItemCount($view) $selected = _GUICtrlListView_GetItemSelected($view, $i) If $selected = True Then MsgBox(0, "", "Item Text :-" & @CRLF & _GUICtrlListView_GetItemTextString($view, $i)) ExitLoop EndIf Next EndFunc ;==>_view Edited August 31, 2009 by furrycow Instant Lockerz Invite - www.instantlockerzinvite.co.uk
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now