Announcement

Collapse

Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

Listview with "sort diamonds"

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

  • PBWin Listview with "sort diamonds"

    Hi all,

    after some pains and a little help from my friend(s) I finally managed to finish my little sort diamond howto with listviews. Binary distribution including bitmaps and resources can be downloaded here: http://www.inside.net/lvdemo.zip
    Latest version includes update of header on header resize.


    [This message has been edited by Balthasar Indermuehle (edited February 05, 2003).]

  • #2
    Dear all,

    The file lvdemo.zip is no longer accessible on the website.

    As anyone a copy of it ?
    Last edited by Jean-Pierre LEROY; 23 Jun 2009, 08:56 AM.
    Jean-Pierre LEROY

    Comment


    • #3
      Administrator please delete if not wanted.
      Attached Files
      :) IRC :)

      Comment


      • #4
        Ian,

        Thank you so much for posting the file again.

        It's exactly what I was looking for.
        Jean-Pierre LEROY

        Comment


        • #5
          This is the sample updated for PB 9.01 and a clean resource file.
          Name changed to avoid repeated names.
          Jordi
          Attached Files

          Comment


          • #6
            Doesn't work when you have right-aligned listview columns. They become left aligned which leaves out sorting numerically.

            Bob Mechler

            Comment


            • #7
              The following will make right aligned work correctly although it uses a global array.

              Code:
              '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
              '* Set the header icons based on the active column (index) and the sort order
              '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
              SUB SetHeaderIcons(BYVAL iActiveColumn AS INTEGER, BYVAL iSortOrder AS INTEGER)
                 LOCAL i AS INTEGER
                 LOCAL hdi AS HD_ITEM
                 LOCAL iAlignRight AS INTEGER
                 FOR i = 0 TO Header_GetItemCount(ghLvHdr) - 1
                    'Go through each column header
                    hdi.mask = %HDI_FORMAT OR %HDI_IMAGE
                    Header_GetItem ghLvHdr, i + 1, hdi
                    'iAlignRight = (hdi.fmt = %HDF_RIGHT)  'Doesn't seem to work
                    IF LV_COLUMN_ALIGN(i) = %LVCFMT_RIGHT THEN 'not elegant but created a global array of header text alignment as listview was built.
                      iAlignRight = 1
                    END IF
                    hdi.fmt = %HDF_STRING OR (iAlignRight AND %HDF_RIGHT)      
                    IF i = iActiveColumn THEN
                       hdi.fmt = hdi.fmt OR %HDF_IMAGE OR ((iAlignRight = %FALSE) AND %HDF_BITMAP_ON_RIGHT)
                    END IF
                    hdi.iImage = iSortOrder
                    CALL Header_SetItem(ghLvHdr, i, hdi)
                 NEXT                              
              END SUB

              Comment

              Working...
              X