Announcement

Collapse
No announcement yet.

ListView: how to get/detect column from cell/item?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ListView: how to get/detect column from cell/item?

    I have a problem by detecting column number from item.

    I get the row number
    for example:

    Code:
    ...
    LOCAL CursorPos      AS POINTAPI
    LOCAL NotifyMsgPtr   AS NMHDR PTR
    LOCAL HitTestLV      AS LV_HITTESTINFO
    LOCAL LVColumn       AS LVCOLUMN
    ..
    ..
    CASE %NM_RCLICK
      IF @NotifyMsgPtr.idFrom = %IDC_LV1 THEN
         GetCursorPos CursorPos
         HitTestLV.pt.x = CursorPos.x
         HitTestLV.pt.y = CursorPos.y
         MapWindowPoints %HWND_DESKTOP, @NotifyMsgPtr.hWndFrom, HitTestLV.pt, 1
         SendMessage @NotifyMsgPtr.hwndFrom, %LVM_HITTEST, 0, VARPTR(HitTestLV)
         RowNrFromItem = HitTestLV.iItem
    
         'SendMessage @NotifyMsgPtr.hwndFrom, %LVM_GETCOLUMN, 0, VARPTR(LVColumn) ???
         'ColNrFromItem = LVColumn.iSubItem
      END IF
    but I can't get column number.
    Help me please.

    Thanks
    Yours sincerely

  • #2
    I have a solution, very simple:

    Code:
    ..
    LOCAL lv             AS NM_LISTVIEW PTR
    ..
    ..
    lv = CBLPARAM
    CASE %NM_RCLICK
      IF @NotifyMsgPtr.idFrom = %IDC_LV1 THEN
         RowNrFromItem = @lv.iItem
         ColNrFromItem = @lv.iSubItem
      END IF


    Thanks
    Yours sincerely

    Comment

    Working...
    X