From: Rob on
I've seen it mentioned in several articles in the MSDN Library and the Visual
Studio help that you can disable individual items in a tree control by
setting a state, yet I cannot find anything anywhere that says what that stat
is. How does one go about enabling and disabling individual items?

I should note that I've set the control to use check boxes, and I am not
supporting any OS older than XP (i.e., I'm only supporting version 6 or newer
of comctl32.dll). (According to the documentation, I should be able to use
check boxes without specifying that my tree control uses images.)
From: David Lowndes on
>I've seen it mentioned in several articles in the MSDN Library and the Visual
>Studio help that you can disable individual items in a tree control by
>setting a state, yet I cannot find anything anywhere that says what that stat
>is. How does one go about enabling and disabling individual items?

Presumably you're referring to something like this:

"For the most part, a tree-view control automatically sets an item's
state to reflect user actions, such as selection of an item. However,
you can also set an item's state by using the TVM_SETITEM message, and
you can retrieve the current state of an item by using the TVM_GETITEM
message. For a complete list of item states, see Tree-View Control
Item States.
"

There are also extended styles - see "Tree-View Control Extended
Styles" which includes TVS_EX_DIMMEDCHECKBOXES (which I presume may be
what you need to make it appear disabled) - but nowhere can I find any
example of using them! :(

Dave
From: Rob on
"David Lowndes" wrote:
> There are also extended styles - see "Tree-View Control Extended
> Styles" which includes TVS_EX_DIMMEDCHECKBOXES (which I presume may be
> what you need to make it appear disabled) - but nowhere can I find any
> example of using them! :(
>
I tried setting the TVS_EX_DIMMEDCHECKBOXES extended style, but it won't
compile (undeclared identifier. I tried a couple of the other ones for the
heck of it, and same thing. As it turns out, none of the tree vew extended
styles are defined in commctrl.h (version 1.2). (I'm using Visual Studio
2005.) Is there anything that I need to #define in order to make the tree
view extended styles become defined?
From: David Lowndes on
>I tried setting the TVS_EX_DIMMEDCHECKBOXES extended style, but it won't
>compile (undeclared identifier. I tried a couple of the other ones for the
>heck of it, and same thing. As it turns out, none of the tree vew extended
>styles are defined in commctrl.h (version 1.2). (I'm using Visual Studio
>2005.) Is there anything that I need to #define in order to make the tree
>view extended styles become defined?

OK you may need an up-to-date Platform SDK. It's defined in the
CommCtrl.h supplied with Orcas B1 like this:

#if (_WIN32_WINNT >= 0x0600)
#define TVS_EX_MULTISELECT 0x0002
#define TVS_EX_DOUBLEBUFFER 0x0004
#define TVS_EX_NOINDENTSTATE 0x0008
#define TVS_EX_RICHTOOLTIP 0x0010
#define TVS_EX_AUTOHSCROLL 0x0020
#define TVS_EX_FADEINOUTEXPANDOS 0x0040
#define TVS_EX_PARTIALCHECKBOXES 0x0080
#define TVS_EX_EXCLUSIONCHECKBOXES 0x0100
#define TVS_EX_DIMMEDCHECKBOXES 0x0200
#define TVS_EX_DRAWIMAGEASYNC 0x0400
#endif

Dave
From: Rob on
"David Lowndes" wrote:

>
> OK you may need an up-to-date Platform SDK. It's defined in the
> CommCtrl.h supplied with Orcas B1 like this:
>
> #if (_WIN32_WINNT >= 0x0600)
<snip>
> #define TVS_EX_DIMMEDCHECKBOXES 0x0200
<snip>
> #endif

That explains a lot. Unfortunately, it appears to be a Vista-only feature,
and we're also supporting XP and Server 2003, so it doesn't help us. I guess
I'm going to have to rough it and do all the hard stuff myself. :-(