RsTVS
asked on
Disable few seleceted items in CTreeCtrl
Hi, can you please tell how we can disable few CTreeCtrl items and few of them enable.
I shouldnt be able to perform any action on those disabled items, i shouldnt be able to check it's check box, i shouldnt be able to edit those items too.
I do not want to use this function:
SetItemStateEx(l_hTempItem , TVIS_EX_DISABLED);
Regards and thanks for the help
I shouldnt be able to perform any action on those disabled items, i shouldnt be able to check it's check box, i shouldnt be able to edit those items too.
I do not want to use this function:
SetItemStateEx(l_hTempItem
Regards and thanks for the help
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The checkboxes are not actual checkboxes, but are in fact images from an image list; you can prove this by using Spy++ on a tree control with checkboxes. Therefore, there is no "control" as such to "disable". Your best bet is to create the illusion of a "disabled" checkbox, by perhaps using a three-state-checkbox tree control, like this one:
http://www.codeguru.com/cpp/controls/treeview/misc-advanced/article.php/c3983/TreeView-with-Three-State-Checkboxes.htm
You still need to keep a list of the items to disable though, so can programatically alter the image being shown to the "disabled" one.
HTH
http://www.codeguru.com/cpp/controls/treeview/misc-advanced/article.php/c3983/TreeView-with-Three-State-Checkboxes.htm
You still need to keep a list of the items to disable though, so can programatically alter the image being shown to the "disabled" one.
HTH
Oh, and to prevent the editing of the label text, you need to trap TVN_ITEMCHANGING, and return TRUE to prevent the edit from being initiated. But again, you still need to keep a list of the items you don't want to be edited.
ASKER
I have tried this method of keeping a list of HTREEITEMS and over rided ON_WM_LBUTTONDOWN, i have omitted defalut handling of lbutton down of CTreeCtrl for all the tree items which i want to be disabled,
Thanks for the help anyway.
Thanks for the help anyway.
ASKER