Results 1 to 2 of 2

Thread: Treeview control needed

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2000
    Posts
    1,463

    Treeview control needed

    Hello,

    Does anyone know if a treeview control that allows me to have checkboxes on the subitems but not on the main nodes? I only want to select items within each section and not see the checkboxes on main section headers.

    Thanks

  2. #2
    Fanatic Member DrUnicode's Avatar
    Join Date
    Mar 2008
    Location
    Natal, Brazil
    Posts
    631

    Re: Treeview control needed

    You can programatically turn off/on individual node checkboxes using the following Sub SetNodeCheck in conjunction with code from this link:
    tvnode-hitem.zip (6kb)
    http://btmtz.mvps.org/treeview/tvnode-hitem.zip

    Code:
    Public Sub SetNodeCheck(ByVal m_Hwnd As Long, nod As Node, ByVal Value As Boolean)
       Dim hItem         As Long
       Dim iCheckState   As Long
       Dim tvi           As TVITEM
       Dim bChange       As Boolean
       
       
       hItem = GetTVItemFromNode(m_Hwnd, nod)
       tvi.mask = TVIS_STATEIMAGEMASK
       tvi.hItem = hItem
       tvi.mask = TVIF_STATE Or TVIF_HANDLE
       SendMessage m_Hwnd, TVM_GETITEM, 0, tvi
    
       tvi.stateMask = TVIS_STATEIMAGEMASK
       
       ' Get that one-based state image 12 bits up,
       ' (2 ^ 12 = &H1000).
       iCheckState = tvi.State \ &H1000
       
       If Value Then
          If (iCheckState = 0) Then
             tvi.State = &H1000
             bChange = True
          End If
       Else
          If (iCheckState <> 0) Then
             tvi.State = 0
             bChange = True
          End If
       End If
       If bChange Then
          tvi.hItem = hItem
          tvi.mask = TVIF_STATE Or TVIF_HANDLE
          SendMessage m_Hwnd, TVM_SETITEM, 0, tvi
       End If
       
    End Sub

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