Results 1 to 18 of 18

Thread: [VB6, Vista+] Undocumented ListView feature: Subsetted Groups (simple, no TLB)

Threaded View

  1. #14
    Hyperactive Member LucasMKG's Avatar
    Join Date
    Jun 2015
    Location
    South Africa (ZAR)
    Posts
    338

    Re: [VB6, Vista+] Undocumented ListView feature: Subsetted Groups (simple, no TLB)

    faf,

    Quote Originally Posted by fafalone View Post
    ...The link doesn't seem to go away, although in the c++ sample is does, so it might vary.
    It doesn't matter, we could toggle between "show all entries" and "minimize again"

    WARNING: solution untidy but somehow works

    In the Subclass_WndProc:
    Code:
        Case WM_LBUTTONDOWN, WM_LBUTTONUP, WM_MBUTTONDOWN, WM_MBUTTONUP, WM_RBUTTONDOWN, WM_RBUTTONUP, WM_MOUSEMOVE
            iBtn = GetMouseButtonState(uMsg)                                            'Seal.added.native ©John Underhill(Steppenwolfe) : vhGrid-clsTreeView : ButtonState - changed to GetMouseButtonState
            iShift = ShiftState()                                                       'Seal.added.based on ©UniListView (Dana Seaman - www.cyberactivex.com)
            GetClientCursorPos m_lHGHwnd, lXPos, lYPos                                  'Seal.added.native ©John Underhill(Steppenwolfe) : vhGrid-clsTreeView
            Select Case uMsg
    
    
                Case WM_LBUTTONUP, WM_MBUTTONUP, WM_RBUTTONUP
                    Select Case uMsg
                        Case WM_LBUTTONUP       '/* release transition mask
                            If (lHwnd = m_lParentHwnd) Then
                                If m_bHasTreeView Then
                                    If TreeViewDividerHitTest Then
                                        m_cTreeView.Refresh True
                                        If Not (m_eGridMode = eVhGrid Or m_eGridMode = eVhGrid_TreeGrid) Then DrawSizer UserControl.hdc                      'Seal.modified
                                    End If
                                End If
                            Else
    'Nowbuffer
                                If m_bColumnSizingVertical Then ColumnSizingVertical = False        'Seal.added : [If m_bColumnSizingVertical Then]
                                ColumnHeaderDragStop
                                If m_bTransitionMask Then
                                    DestroyTransitionMask
                                End If
                            End If
    
    'GroupView ...................
                        'Seal.added: based on © 2016 ©VBForums (Jonney) - Thread '[RESOLVED] LVN_LINKCLICK inhibited by WM_LBUTTONDOWN'
                        If GroupView Then
            
                            GetCursorPos tPnt
                            ScreenToClient m_lHGHwnd, tPnt
                            
                            With uLVHI
                                .pt.x = tPnt.x
                                .pt.y = tPnt.y
                
                                Call SendMessage(m_lHGHwnd, LVM_HITTEST, -1, VarPtr(uLVHI))
        
                                Select Case .flags
                                  '/  Case LVHT_EX_GROUP_HEADER
                                  '/      bHandled = False   '/* Bypass default behavior
                                  '/      MsgBox "LVHT_EX_GROUP_HEADER"
                                    Case LVHT_EX_GROUP_FOOTER                            '.works
                                        MsgBox "LVHT_EX_GROUP_FOOTER "
                                    Case LVHT_EX_GROUP_COLLAPSE
                                        MsgBox "LVHT_EX_GROUP_COLLAPSE "
                                    Case LVHT_EX_GROUP_BACKGROUND
                                        MsgBox "LVHT_EX_GROUP_BACKGROUND "
                                    Case LVHT_EX_GROUP_STATEICON                            '.works
                                        MsgBox "LVHT_EX_GROUP_STATEICON "
                                  '/  Case LVHT_EX_GROUP_SUBTITLE
                                  '/      MsgBox "LVHT_EX_GROUP_SUBTITLE "
                                    Case LVHT_EX_GROUP_SUBSETLINK                            '.works
                                    'Seal.added: SubsetLink | toggle "Show all entries" & "minimise again..."
                                        Dim bGroupSubseted As Boolean
                                        
                                        bGroupSubseted = FGroupSubseted(.iGroup)
                                        mFGroupSubseted .iGroup, bGroupSubseted
                                        
                                    Case LVHT_EX_GROUP
                                        MsgBox "LVHT_EX_GROUP "
                                    Case LVHT_EX_ONCONTENTS                    'On item AND not on the background
                                        MsgBox "LVHT_EX_ONCONTENTS "
                                    Case LVHT_EX_FOOTER                            '.works
                                        MsgBox "LVHT_EX_FOOTER "
                                    Case LVHT_EX_GROUP
                                        MsgBox "LVHT_EX_GROUP "
                                    Case Else
                                  '/      MsgBox "Case Else: " & .flags
                                End Select
                            End With
                        End If
    'GroupView ...................
    
                            'Seal.added :: to set SubItem FocusRect
                            If (m_eGridMode = eLVS_Report) And CellInFocus > 0 Then SubItemSelected
                            RaiseEvent MouseUp(iBtn, iShift, CSng(lXPos), CSng(lYPos))     'Seal.added.native ©John Underhill(Steppenwolfe) : vhGrid-clsTreeView
    'Debug.Print "WM_LBUTTONUP"
                        Case WM_MBUTTONUP
                            RaiseEvent MouseUp(iBtn, iShift, CSng(lXPos), CSng(lYPos))     'Seal.added.native ©John Underhill(Steppenwolfe) : vhGrid-clsTreeView
    'Debug.Print "WM_MBUTTONUP"
                        Case WM_RBUTTONUP
                            RaiseEvent MouseUp(iBtn, iShift, CSng(lXPos), CSng(lYPos))     'Seal.added.native ©John Underhill(Steppenwolfe) : vhGrid-clsTreeView
    'Debug.Print "WM_RBUTTONUP"
                    End Select
                    If bIsClick = True Then
                        bIsClick = False
                        If (lXPos >= 0 And lXPos <= UserControl.Width) _
                        And (lYPos >= 0 And lYPos <= UserControl.Height) Then _
                            RaiseEvent Click
                    End If

    Code:
    Function mFGroupSubseted(ByVal iGrpId As Long, ByVal bSubseted As Boolean)
        If Not (m_lHGHwnd = 0) Then
            Dim sSubsetLink As String
            Dim LVG As LVGROUP
    
            With LVG
                '*/ returns or sets the subsettitle link of the group
                If bSubseted Then
                    sSubsetLink = "minimise again..."
                Else
                    sSubsetLink = "Show all entries "
                End If
    
                .cbSize = LenB(LVG)
                .stateMask = .stateMask Or LVGS_SUBSETED
                .Mask = .Mask Or LVGF_STATE Or LVGF_SUBSET
                .pszSubsetTitle = StrPtr(sSubsetLink)
                .cchSubsetTitle = LenB(sSubsetLink)
    
                .State = IIf(bSubseted = False, LVGS_SUBSETED, LVGS_NORMAL)
                '*/ when TRUE the group displays only a portion of its items _
                 A value of 0 indicates that all list items are displayed, which means no subset. _
                 Requires comctl32.dll version 6.1 or higher."
    
                SendMessage m_lHGHwnd, LVM_SETGROUPINFO, iGrpId, VarPtr(LVG)
            End With
        End If
    
    End Function

    ommited
    Code:
    'Seal.added.based on ©Krool : CommonControls (Replacement of the MS common controls)
    Property Get FGroupSubseted(ByVal iGrpId As Long) As Boolean
    'If ListViewHandle <> 0 And ComCtlsSupportLevel() >= 2 Then
    '    If IsGroupAvailable(ID) = True Then
    'FGroupSubseted = CBool(SendMessage(m_lHGHwnd, LVM_GETGROUPSTATE, iGrpId, ByVal LVGS_SUBSETED) <> 0)
    FGroupSubseted = CBool(SendMessage(m_lHGHwnd, LVM_GETGROUPSTATE, iGrpId, ByVal LVGS_SUBSETED) <> 0)
    'End If
    End Property
    LucasMKG
    trying to make a comeback...revising
    Last edited by LucasMKG; Feb 21st, 2022 at 03:38 AM.

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