|
Question : How to disable a item in the treectrl?
|
|
Hi, I wanna disable a item in the treectrl. But after a search in MSDN, I can't find any answer. The treectrl item state contains no flag for disabling. So how can I do?
Any comment is greatly appreciated.
Lite
|
|
Answer : How to disable a item in the treectrl?
|
|
The tree control by default does not provide the functionality to disable an item. However, you can achieve that by some customizations.
To make an item non-selectable, you can use the TVN_SELCHANGING and TVN_SELCHANGED notifications.
The first one informs you about a selection change to happen (and you can cancel it), the other one informs you that a selection change just happened.
When designing the behavior, you should make sure that keyboard usage will still be possible. The easiest approach - canceling all selection changes that go to an item that is disabled - will for sure break keyboard usage.
If you also want to change the appearance of the disabled item(s), you should explore the CustomDraw notifications of the tree control
I hope this gives you some point to start, if you need more information just ask.
|
|
|
|