Jump to content

_GUICtrlListView_AddSubItem


Recommended Posts

$counter = _GUICtrlListView_GetItemCount($nListview)
$counter = $counter+1
_GUICtrlListView_AddSubItem($nListview, 3, $Input, 2)

Thats supposed to add to the 2nd column, 3rd one in the listview right?

Wrong.

The item is not even showing up after this is all done.

I need serious help.

Edited by nowagain
Link to comment
Share on other sites

Is the Listview in "Report" View?

In Icon, Small Icon or List Mode (View) you will not see sub-item columns.

$counter = _GUICtrlListView_GetItemCount($nListview)
$counter = $counter+1
_GUICtrlListView_AddSubItem($nListview, 3, $Input, 2)

Thats supposed to add to the 2nd column, 3rd one in the listview right?

Wrong.

The item is not even showing up after this is all done.

I need serious help.

Link to comment
Share on other sites

$nListview = GUICtrlCreateListView("Column1  |Column2   |Column3", 19, 120, 176, 150, -1, 
$WS_EX_CLIENTEDGE)

thats how i created my listview.

i don't want to create a new column, just merely want to add data to my second column.

Link to comment
Share on other sites

Perhaps an Example would help.

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

$GUI = GUICreate("ListView", 633, 447, -1, -1)
;$nListview = GUICtrlCreateListView("Column1  |Column2   |Column3", 19, 120, 176, 150, -1, $WS_EX_CLIENTEDGE)
; Above commented out, only change is positioning of the ListView in the GUI
$nListview = GUICtrlCreateListView("Column1  |Column2   |Column3", 72, 8, 553, 425, -1, $WS_EX_CLIENTEDGE)
For $I = 1 to 20
    $Txt = "Item-" & $I
    $nLVItem = _GUICtrlListView_AddItem($nListview, $Txt)
    For $K = 1 To 2
        _GUICtrlListView_SetItemText($nListview, $nLVItem, $Txt & ", Column-" & $K, $K)
        Next ;$K
Next ;$I

GUISetState(@SW_SHOW)

While 1
    $I = GUIGetMsg()
    Switch $I
    Case $GUI_EVENT_CLOSE
         ExitLoop
    EndSwitch
Wend

$nListview = GUICtrlCreateListView("Column1  |Column2   |Column3", 19, 120, 176, 150, -1, 
$WS_EX_CLIENTEDGE)

thats how i created my listview.

i don't want to create a new column, just merely want to add data to my second column.

Link to comment
Share on other sites

I did this and it still doesn't work.

$counter = _GUICtrlListView_GetItemCount($nListview)
$counter = $counter+1
$nV_Litem = _GUICtrlListView_AddItem($nListview, GUICtrlRead($Input))
_GUICtrlListView_SetItemText($nListView, $nV_Litem, GUICtrlRead($Input))
Link to comment
Share on other sites

_GUICtrlListView_AddItem ; <= To Add an Item (Row)

_GUICtrlListView_SetItemText ; <= To Change the text of an item or subitem (Column) Later on

Without using the UDF, if you already know what the contents of the item and subitems are, you could just use:

$item1 = GUICtrlCreateListViewItem("item1|Item1, col2|Item2, col3", $listview)

To see how it works, add the line below before the For $I = 1... Line in the example code I posted

$I = GUICtrlCreateListViewItem("Item0|Item0, Column-1|Item0, Column-2", $nListview)

So I use

_GUICtrlListView_AddItem()
instead?
Edited by DaRam
Link to comment
Share on other sites

You have not supplied the item or subitem column #

_GUICtrlListView_SetItemText($nListView, $nV_Litem, GUICtrlRead($Input), 2)

I did this and it still doesn't work.

$counter = _GUICtrlListView_GetItemCount($nListview)
$counter = $counter+1
$nV_Litem = _GUICtrlListView_AddItem($nListview, GUICtrlRead($Input))
_GUICtrlListView_SetItemText($nListView, $nV_Litem, GUICtrlRead($Input))
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...