Sign in to follow this  
Followers 0
aakira

using an element from an array or listview

2 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by furrycow

Instant Lockerz Invite - www.instantlockerzinvite.co.uk

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0