Announcement

Collapse
No announcement yet.

Arrow images in listview column headers

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

  • Arrow images in listview column headers

    I tried this code:http://www.powerbasic.com/support/pb...ad.php?t=19924

    Clicking the button does not add the arrow to the column header. Does it work for anyone else? If so, what am I doing wrong? I loaded the latest Win32Api.

    Thanks for your help!

  • #2
    I had to change a few equates around for me to get it to work (redraw is a bit flaky though - not necessary to add text).

    Code:
    SUB AddImageToListViewColumnHeader(hDlg AS DWORD)
      
      LOCAL hHeader AS LONG
      LOCAL hdi     AS HD_ITEM
      LOCAL szItem  AS ASCIIZ*32
      LOCAL hBmp    AS LONG
      LOCAL nCol    AS LONG
      '
      'get a handle to the listview header component
      hHeader = SendMessage(hListView, %LVM_GETHEADER, 0, 0)
      '
      'set up the required structure members
      hdi.mask    = %HDI_BITMAP OR %HDI_FORMAT
      hdi.fmt     = %HDF_STRING OR %HDF_IMAGE OR %HDF_BITMAP
      hdi.iImage  = hBmp1
      '
      nCol = 0 ' Test for 1st column only
      SendMessage hHeader, %HDM_SETITEM, nCol, VARPTR(hdi)
      
    END SUB
    Adam Drake
    Drake Software

    Comment


    • #3
      This worked for me..
      Code:
        'set up the required structure members
        szItem      = "Got it"
        hdi.mask    = %HDI_FORMAT OR %HDI_TEXT OR %HDI_BITMAP
        hdi.pszText = VARPTR(szItem)
        hdi.fmt     = %HDF_STRING OR %HDF_RIGHT OR %HDF_BITMAP OR %HDF_BITMAP_ON_RIGHT
        hdi.hbm     = hBmp1
      (WinXP home)
      Noted that SDK has other options for displaying up/down arrows - requires Version 6 of Comctl32.dll (WinXP +) though.
      Rgds, Dave

      Comment

      Working...
      X