Jump to content

Treeview Checkboxes?


 Share

Recommended Posts

Well i've made a treeview with TVS_CHECKBOXES.

Works all great only one problem:

i have an item, lets call it bla

and 2 subitems blo&bli

I want checkboxes for blo&bli but not for the parent item (bla)..

How to "remove" the parent-checkbox ?

(with tvs_checkboxes enabled every item gets a checkbox; ...)

Link to comment
Share on other sites

Try this (beta required):

#include <GUIConstants.au3>

; Next 
;#include <GUITreeView.au3>

; Or this
Global Const $TVIF_STATE            = 0x0008
Global Const $TVIS_STATEIMAGEMASK   = 0xF000
Global Const $TV_FIRST              = 0x1100
Global Const $TVM_SETITEM           = $TV_FIRST + 13

GUICreate('Test')

$tv         = GUICtrlCreateTreeView(10, 10, 200, 200, BitOr($TVS_HASBUTTONS, $TVS_DISABLEDRAGDROP, $TVS_HASLINES, $TVS_HASLINES, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES))
$tvitem1    = GUICtrlCreateTreeViewItem('Item1', $tv)
$tvitem2    = GUICtrlCreateTreeViewItem('Item2', $tvitem1)
$tvitem3    = GUICtrlCreateTreeViewItem('Item3', $tvitem1)

GUICtrlSetState($tvitem1, $GUI_EXPAND)

RemoveCheckbox($tv, $tvitem1)

GUISetState()

While 1
    $Msg = GUIGetMsg()
    
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

Exit

Func RemoveCheckbox($nTV, $nID)
    Local $hItem = GUICtrlGetHandle($nID)
    If $hItem = 0 Then $hItem = $nID
    
    Local $stTVITEM = DllStructCreate('uint;uint;uint;uint;ptr;int;int;int;int;uint;int')
    
    DllStructSetData($stTVITEM, 1, $TVIF_STATE)
    DllStructSetData($stTVITEM, 2, $hItem)
    DllStructSetData($stTVITEM, 3, 0)
    DllStructSetData($stTVITEM, 4, $TVIS_STATEIMAGEMASK)
    
    GUICtrlSendMsg($nTV, $TVM_SETITEM, 0, DllStructGetPtr($stTVITEM))
EndFunc

Greets

Holger

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...