Sign in to follow this  
Followers 0
Champak

Cant get GUICtrlCreateList and GUICtrlSetData to work with multi-D array

3 posts in this topic

#1 ·  Posted (edited)

This was working fine when I had it in a 1D array, now I get the count in the msgbox, and it writes them out to the console, but it wont populate the list.

The array is a 2D + the index numbers. (P.S. Is that 3D or just 2D?)

$SongListView = GUICtrlCreateList ("",10,10,440,260,$WS_BORDER+$WS_VSCROLL+$WS_TABSTOP+$LBS_NOTIFY)
    GUICtrlSetFont(-1, 16, 700, "")

    MsgBox(0,0,UBound($aSource,1));TEST
    For $z = 0 To UBound($aSource,1) - 1
        GUICtrlSetData($SongListView,StringReplace($aSource[$z][0],@MyDocumentsDir & "\My Music\",""))
        ConsoleWrite($aSource[$z][0] & @CRLF);TEST
    Next
Edited by Champak

Share this post


Link to post
Share on other sites



#include <GUIConstants.au3>
Global $aSource[2][3]
$aSource[0][0]="Upper-Left"
$aSource[1][0]="Lower-Left"
$aSource[0][1]="Upper-Right"
$aSource[1][1]="Lower-Right"
$aSource[0][2]="Top"
$aSource[1][2]="Bottom"
$GUI = GUICreate (450, 270)
$SongListView = GUICtrlCreateList("", 10, 10, 440, 260, $WS_BORDER + $WS_VSCROLL + $WS_TABSTOP + $LBS_NOTIFY)
GUICtrlSetFont(-1, 16, 700, "")

MsgBox(0, 0, UBound($aSource, 1));TEST
For $z = 0 To UBound($aSource, 1) -1 
    GUICtrlSetData($SongListView, $aSource[$z][0])
    ConsoleWrite($aSource[$z][0] & @CRLF);TEST
Next

GUISetState (@SW_SHOW)

While 1
    $nMsg = GUIGetMsg ()
    Switch $nMsg
        Case -3
            Exit
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

Thanks for your help, but it turns out that wasn't my problem. An extra blank row was being created at the end of my array; that blank row was causing the data not to set. All fixed now though.

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