PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: xstreur on February 01, 2017, 08:59:51 AM

Title: Listview problem adding items
Post by: xstreur on February 01, 2017, 08:59:51 AM
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
Title: Re: Listview problem adding items
Post by: Paul Squires on February 01, 2017, 09:38:22 AM
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.")

Title: Re: Listview problem adding items
Post by: xstreur on February 03, 2017, 10:24:22 AM
Of cause .... thanks, I managed to do the trick this time.