Listview problem adding items

Started by xstreur, February 01, 2017, 08:59:51 AM

Previous topic - Next topic

xstreur

Hello I try to fill my Listview from WM_CREATE, but it just adds the first item in  Column 0.

Listview properties:

[ControlType] ListView | PropertyCount=34 | zorder=8 | tabindex=1 |
name=lvInteract
windowstyles=WS_CHILD, WS_VISIBLE, WS_TABSTOP, LVS_REPORT, LVS_SHOWSELALWAYS|WS_EX_CLIENTEDGE, WS_EX_LEFT, WS_EX_RIGHTSCROLLBAR

Code:

Sub GetAndFillIAListView
    Dim rc as Integer
    Dim Temp as String
   
    'Cleanup Listview
        FF_ListView_DeleteAllColumns(HWND_PPINTERACTIONS_LVINTERACT)
    'Prepare Listvie
        rc = FF_ListView_InsertColumn(HWND_PPINTERACTIONS_LVINTERACT, 0, "Datum", LVCFMT_RIGHT, 100)
        rc = FF_ListView_InsertColumn(HWND_PPINTERACTIONS_LVINTERACT, 1, "Type", LVCFMT_LEFT, 100)
        rc = FF_ListView_InsertColumn(HWND_PPINTERACTIONS_LVINTERACT, 2, "Uren", LVCFMT_RIGHT, 100)
        rc = FF_ListView_InsertColumn(HWND_PPINTERACTIONS_LVINTERACT, 3, "Opmerkingen", LVCFMT_LEFT, 400)
   
    'Fill Listview
       
        rc = FF_ListView_InsertItem(HWND_PPINTERACTIONS_LVINTERACT, 1, 0, "01-01-2017")
        rc = FF_ListView_InsertItem(HWND_PPINTERACTIONS_LVINTERACT, 1, 1, "Behandeling")
        rc = FF_ListView_InsertItem(HWND_PPINTERACTIONS_LVINTERACT, 1, 2, "1.00")
        rc = FF_ListView_InsertItem(HWND_PPINTERACTIONS_LVINTERACT, 1, 3, "Testinteractie.")
                 
End Sub
Cheers
Frans (X.I.E.M.) Streur
--------------------------------------------
Windows 7 SP1
Freebasic 1.05
FireFly 3.78

Paul Squires

ListView row numbers are zero-based so the code should look like this (notice I used 0 rather than 1 for the row number to insert):


        rc = FF_ListView_InsertItem(HWND_PPINTERACTIONS_LVINTERACT, 0, 0, "01-01-2017")
        rc = FF_ListView_InsertItem(HWND_PPINTERACTIONS_LVINTERACT, 0, 1, "Behandeling")
        rc = FF_ListView_InsertItem(HWND_PPINTERACTIONS_LVINTERACT, 0, 2, "1.00")
        rc = FF_ListView_InsertItem(HWND_PPINTERACTIONS_LVINTERACT, 0, 3, "Testinteractie.")

Paul Squires
PlanetSquires Software

xstreur

Of cause .... thanks, I managed to do the trick this time.
Cheers
Frans (X.I.E.M.) Streur
--------------------------------------------
Windows 7 SP1
Freebasic 1.05
FireFly 3.78