Results 1 to 2 of 2

Thread: Clciking listview header with icon loses right justify

  1. #1

    Thread Starter
    Frenzied Member Blobby's Avatar
    Join Date
    Oct 2001
    Location
    England
    Posts
    1,512

    Clciking listview header with icon loses right justify

    Hello peeps,

    I have a listview with an ascending/descending icon available on each header which shows the sort order of the column.
    My problem is that my numeric field (file size) is right justified when i launch the program and populate the listview but when i click on this header it adds the icon showing the currnt sort order but the column reverts to left justify. Heres my code...what do i do to make it right justify again? Thanks

    VB Code:
    1. Private Const HDI_BITMAP = &H10
    2. Private Const HDI_IMAGE = &H20
    3. Private Const HDI_FORMAT = &H4
    4. Private Const HDI_TEXT = &H2
    5.  
    6. Private Const HDF_BITMAP_ON_RIGHT = &H1000
    7. Private Const HDF_BITMAP = &H2000
    8. Private Const HDF_IMAGE = &H800
    9. Private Const HDF_STRING = &H4000
    10.  
    11. Private Type HD_ITEM
    12.    mask As Long
    13.    cxy As Long
    14.    pszText As String
    15.    hbm As Long
    16.    cchTextMax As Long
    17.    fmt As Long
    18.    lParam As Long
    19.    iImage As Long
    20.    iOrder As Long
    21. End Type
    22.  
    23.  
    24.  
    25.  
    26. Public Sub ShowHeaderIcon(colNo As Long, imgIconNo As Long, showImage As Long, LView As Listview)
    27.  
    28.    Dim hHeader As Long
    29.    Dim HD As HD_ITEM
    30.    
    31.   'get a handle to the listview header component
    32.    hHeader = SendMessage(LView.hwnd, LVM_GETHEADER, 0, ByVal 0)
    33.    
    34.   'set up the required structure members
    35.    With HD
    36.       .mask = HDI_IMAGE Or HDI_FORMAT
    37.       .pszText = LView.ColumnHeaders(colNo + 1).Text
    38.      
    39.        If showImage Then
    40.          If colNo = 1 And LView.Name = "MatchFiles" Then
    41.             .fmt = HDF_STRING Or HDF_IMAGE
    42.          Else
    43.             .fmt = HDF_STRING Or HDF_IMAGE Or HDF_BITMAP_ON_RIGHT
    44.          End If
    45.          .iImage = imgIconNo
    46.        Else
    47.          .fmt = HDF_STRING
    48.       End If
    49.  
    50.  
    51.    End With
    52.    
    53.   'modify the header
    54.    Call SendMessage(hHeader, HDM_SETITEM, colNo, HD)
    55.    
    56. End Sub
    There are 3 types of people in this world.........those that can count, and those that can't.

    Blobby

  2. #2

    Thread Starter
    Frenzied Member Blobby's Avatar
    Join Date
    Oct 2001
    Location
    England
    Posts
    1,512
    A toughie huh?
    There are 3 types of people in this world.........those that can count, and those that can't.

    Blobby

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width