Sign in to follow this  
Followers 0
Chillosophy

Retrieving all ListView items

3 posts in this topic

Hi there,

I'm a total newbie to AutoIt and I've got a simple question. How can I get all items from a listview, instead of just the selected one(s)?

Thanks in advance!

Share this post


Link to post
Share on other sites



Hi there,

I'm a total newbie to AutoIt and I've got a simple question. How can I get all items from a listview, instead of just the selected one(s)?

Thanks in advance!

Look in the UDF section of the Help file, GuiListView Management

Example:

#include <GuiConstants.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)
Dim $listview, $Btn_Get, $Btn_Exit, $msg, $Status, $ret, $x
GUICreate("ListView Get Item Text", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149)
GUICtrlCreateListViewItem("line1|data1|more1", $listview)
GUICtrlCreateListViewItem("line2|data2|more2", $listview)
GUICtrlCreateListViewItem("line3|data3|more3", $listview)
GUICtrlCreateListViewItem("line4|data4|more4", $listview)
GUICtrlCreateListViewItem("line5|data5|more5", $listview)
$Btn_Get = GUICtrlCreateButton("Get All", 75, 200, 90, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
$Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
            ExitLoop
        Case $msg = $Btn_Get
            For $x = 0 To _GUICtrlListViewGetItemCount($listview) - 1
                $ret = MsgBox(1, "item: " & $x, _GUICtrlListViewGetItemText($listview, $x))
                If $ret = 2 Then ExitLoop ; user selected cancel
            Next
    EndSelect
WEnd
Exit

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

The manual is like a big haystack to me, but I'll get there. Thanks for the quick reply!

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