PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: ListView_AddSubItem  (Read 81 times)

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 8865
  • Windows 10
    • PlanetSquires Software
ListView_AddSubItem
« 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
' ========================================================================================


Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Josť Roca

  • Moderator
  • Guru Member
  • *****
  • Posts: 3205
Re: ListView_AddSubItem
« Reply #1 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?

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 8865
  • Windows 10
    • PlanetSquires Software
Re: ListView_AddSubItem
« Reply #2 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.
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer