Jump to content
Sign in to follow this  
florisch

Strange behaviour reading rows from Listview

Recommended Posts

florisch

This is a piece of my code:

#include <GUIConstants.au3>
#Include <GuiListView.au3>

$Form1          = GUICreate("Automated tests: configuration",       695, 700, 195, 118)
$ListView       = GUICtrlCreateListView("Status    |Testconfiguration",  16, 170, 530, 460, BitOR($LVS_REPORT,$LVS_NOSORTHEADER,$LVS_SHOWSELALWAYS), BitOR($WS_EX_CLIENTEDGE,$LVS_EX_FULLROWSELECT))
$BtnStart       = GUICtrlCreateButton("Start testing",              300, 650, 226, 30, $BS_DEFPUSHBUTTON)
GUISetState(@SW_SHOW)

$items = StringSplit("1","|")
GUICtrlCreateListViewItem("Test 1|" & "some content", $ListView)
GUICtrlCreateListViewItem("Test 2|" & "some  more content", $ListView)

While 1 ; Main loop, GUI-manager
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        case $BtnStart
            MsgBox(0,"1",_GUICtrlListViewGetItemText($ListView, 1))
            MsgBox(0,"2",_GUICtrlListViewGetItemText($ListView, 1,0))
            MsgBox(0,"3",_GUICtrlListViewGetItemText($ListView, 1,1))
            MsgBox(0,"4",$items[$i])
            MsgBox(0,"5",_GUICtrlListViewGetItemText($ListView, $items[1],1)) ; Why is this not working?
    EndSwitch
WEnd

And Message Box 5 remains empty.

Oh no! I got it while describing the problem. $items[1] is a string . . . making it int($items[1]) works.

I found nothing in the help-forum, maybe I am the only one, but I post this nonetheless. Just in case someone tries this too ...

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.