qwert

Puzzled by blank lines in ListView GUI

5 posts in this topic

Would anyone happen to know why _AddArray appends a couple of blank lines to the contents?

I've only recently started to use some of the update/add features and am at a loss about this effect ... even what to try as a test ... although I did find this good explanation of items and subitems: ListView Items and Subitems

Here's my test script that produces the GUI I've attached:

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>

Local $array[5][3] = [ ['C:\Program Files','12/01/2016','201'], _
                            ['D:\Au3 Scripts','07/03/2014','301'], _
                            ['F:\Downloads','01/01/2017','101'] ]

$GUI = GUICreate("ListView Test", 400, 320, -1, 180)

$Go = GUICtrlCreateButton("Go", 324, 84, 60, 28)
GUICtrlSetTip(-1, "Select a listview entry and click Go")

$Elements = GUICtrlCreateListView("", 24, 12, 280, 280)

_GUICtrlListView_AddColumn($Elements, "Directory Name", 200)
_GUICtrlListView_AddColumn($Elements, "Date", 76)
_GUICtrlListView_AddColumn($Elements, "Unseen sort", 0)

_GUICtrlListView_AddArray($Elements, $array)    ; where are blank lines coming from?
;_GUICtrlListView_AddArray($Elements, $array)   ; even this results in 2 blank lines

Local $item = _GUICtrlListView_AddItem($Elements, "F:\Newest")
_GUICtrlListView_AddSubItem($Elements, $item, "01/01/2015", 1)
_GUICtrlListView_AddSubItem($Elements, $item, "001", 2)

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    Case $Go
        $Line = _GUICtrlListView_GetItemTextString($Elements)
        msgbox(0, "Operation", $Line)
    EndSwitch
WEnd

I'll certainly appreciate any help with this.  Thanks.

 

ListView Blank Lines.PNG

 

Share this post


Link to post
Share on other sites



Change your array to [3][3].. the [5][3] adds 2 lines

Local $array[3][3]

 

Share this post


Link to post
Share on other sites

Fixed.  "It's all details!" ... and I didn't see that.

Thanks very much.

Share this post


Link to post
Share on other sites

Or let AutoIt manage the size of the array:

Local $array[][] = [ ['C:\Program Files','12/01/2016','201'], _
                          ['D:\Au3 Scripts','07/03/2014','301'], _
                          ['F:\Downloads','01/01/2017','101'] ]

 

1 person likes this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

@water: that's a very good suggestion.  Predefining has tripped me up, before ... yet I've never used [ ][ ].

Thanks.

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