Jump to content
Sign in to follow this  

Another treeview question - making only some items have checkboxes

Recommended Posts


I'm trying to create a treeview of parent and child objects, where only the child objects have checkboxes next to them. However, it seems like whether or not there are checkboxes is defined for the entire treeview with $TVS_CHECKBOXES, and I don't see any way to define it per-item. Here's what I have so far to create a basic treeview where everything has checkboxes and the parent items have a slightly different GUI style:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <TreeViewConstants.au3>

Local $mainTree, $treeitem2, $treesubitem1, $treesubitem2, $treesubitem3, $treesubitem4, $guiMsg
Local $parentItemStyle = BitOR($GUI_EXPAND, $GUI_DEFBUTTON)

GUICreate("Treeview With Children", 400, 300)

$mainTree = GUICtrlCreateTreeView(2, 2, 396, 268, $mainTreeStyle, $WS_EX_CLIENTEDGE)

$treeitem1 = GUICtrlCreateTreeViewItem("Parent Item 1", $mainTree)
$treesubitem1 = GUICtrlCreateTreeViewItem("Child Item 1", $treeitem1)
$treesubitem2 = GUICtrlCreateTreeViewItem("Child Item 2", $treeitem1)
$treeitem2 = GUICtrlCreateTreeViewItem("Parent Item 2", $mainTree)
$treesubitem3 = GUICtrlCreateTreeViewItem("Child Item 1", $treeitem2)
$treesubitem4 = GUICtrlCreateTreeViewItem("Child Item 2", $treeitem2)

GUICtrlSetState($treeitem1, $parentItemStyle)
GUICtrlSetState($treeitem2, $parentItemStyle)


    $guiMsg = GUIGetMsg()

Is there a way to make it so the parent items don't have checkboxes but the child items do?

Thanks so much ^_^

Share this post

Link to post
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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.