PlanetSquires Forums

Support Forums => WinFBX - Windows Framework for FreeBASIC => Topic started by: Paul Squires on October 03, 2019, 03:21:43 PM

Title: ListView_AddSubItem
Post by: Paul Squires on October 03, 2019, 03:21:43 PM
Hi Jose, I never saw such a function in the AfcCtl.inc file, so maybe the one below could be considered to be added.

Code: [Select]
' ========================================================================================
' Inserts a subitem into a list-view control.
' - hwndLV: Handle to the ListView control.
' - nItem: Zero-based index at which the new item should be inserted. If this value is
'   greater than the number of items currently contained by the listview control, the new
'   item will be appended to the end of the list and assigned the correct index. Examine the
'   return value to determine the actual index assigned to the item.
' - nSubItem: One-based index of the subitem.
' - pwszText: The item text.
' Returns TRUE if successful, or FALSE otherwise.
' ========================================================================================
PRIVATE FUNCTION ListView_AddSubItem (BYVAL hwndLV AS HWND, BYVAL nItem AS LONG, BYVAL nSubItem AS LONG, BYVAL pwszText AS WSTRING PTR) AS boolean
   DIM lvi AS LVITEMW
   lvi.mask = LVIF_TEXT
   lvi.pszText = pwszText
   lvi.iItem = nItem
   lvi.iSubItem = nSubItem
   FUNCTION = SendMessageW(hwndLV, LVM_SETITEM, 0, cast(LPARAM, cast(LVITEMW PTR, @lvi)))
END FUNCTION
' ========================================================================================


Title: Re: ListView_AddSubItem
Post by: Josť Roca on October 03, 2019, 03:51:48 PM
Sorry. I don't understand. The number of subitems is dictated by the number of columns. Maybe you're thinking in ListView_SetItemText, which allows to specify the item and the subitem?

Title: Re: ListView_AddSubItem
Post by: Paul Squires on October 03, 2019, 07:00:03 PM
Sorry, right you are. I forgot to check the listview macros.... the ListView_SetItemText macro is what I'm looking for.