I'm trying to use a Treeview control. I'd like to have all child nodes be
automatically unchecked if a if I uncheck a parent node. Also, is there a
way to specify that if a node contains child nodes it'll automatically be
bold?

I've got drag 'n drop working on my treeview and so I'd like any parent
nodes to bold themselves.

I would love it if someone could help me with this. Even better; does
anyone know a really, really good and simple to understand novice to advanced
tutorial on how to program treeview controls? This would help prevent me
from bugging everyone about my treeview woes.

RE: Uncheck child nodes if parent node is unchecked in treeview by JonathanBrown

JonathanBrown
Tue Oct 07 18:00:01 CDT 2008

Okay, so I found this post:

http://bytes.com/forum/thread388871.html

Which is extremely helpful. And essentially answers my question. But I'm
still open to a really good treeview control tutorial if anyone's got one.

Thanks

"Jonathan Brown" wrote:

> I'm trying to use a Treeview control. I'd like to have all child nodes be
> automatically unchecked if a if I uncheck a parent node. Also, is there a
> way to specify that if a node contains child nodes it'll automatically be
> bold?
>
> I've got drag 'n drop working on my treeview and so I'd like any parent
> nodes to bold themselves.
>
> I would love it if someone could help me with this. Even better; does
> anyone know a really, really good and simple to understand novice to advanced
> tutorial on how to program treeview controls? This would help prevent me
> from bugging everyone about my treeview woes.

Re: Uncheck child nodes if parent node is unchecked in treeview by st

st
Tue Oct 07 21:10:31 CDT 2008

IkpvbmF0aGFuIEJyb3duIiA8Sm9uYXRoYW5Ccm93bkBkaXNjdXNzaW9ucy5taWNyb3NvZnQuY29t
PiDRgdC+0L7QsdGJ0LjQuy/RgdC+0L7QsdGJ0LjQu9CwINCyINC90L7QstC+0YHRgtGP0YUg0YHQ
u9C10LTRg9GO0YnQtdC1OiBuZXdzOjQ1QTE3NUU3LTk1MDUtNEQ2Ny04OTAwLTBGNkFDQTg4NDc1
N0BtaWNyb3NvZnQuY29tLi4uDQo+PiBJJ20gdHJ5aW5nIHRvIHVzZSBhIFRyZWV2aWV3IGNvbnRy
b2wuICBJJ2QgbGlrZSB0byBoYXZlIGFsbCBjaGlsZCBub2RlcyBiZSANCj4+IGF1dG9tYXRpY2Fs
bHkgdW5jaGVja2VkIGlmIGEgaWYgSSB1bmNoZWNrIGEgcGFyZW50IG5vZGUuICBBbHNvLCBpcyB0
aGVyZSBhIA0KPj4gd2F5IHRvIHNwZWNpZnkgdGhhdCBpZiBhIG5vZGUgY29udGFpbnMgY2hpbGQg
bm9kZXMgaXQnbGwgYXV0b21hdGljYWxseSBiZSANCj4+IGJvbGQ/DQoNCjEuIFlvdSBuZWVkIHRv
IGl0ZXJhdGUgdGhlIGNvbGxlY3Rpb24gb2YgY2hpbGRyZW4gb2YgdGhlIG5vZGUgYmVpbmcgdW5j
aGVja2VkIGFuZCB1bmNoZWNrIGVhY2ggb2YgdGhlbSBpbmRpdmlkdWFsbHkuDQoNCjIuIFllcywg
b2YgY291cnNlLiAnT3InIFRWSVNfQk9MRCBjb25zdGFudCB0byBpdGVtIHN0eWxlIHdoZW4gYWRk
aW5nIGl0J3MgY2hpbGRyZW4uIENoZWNrIE9iamVjdCBCcm93c2VyIChbRjJdIGtleSBpbiBWQikg
dG8gc2VlIFZCIGVxdWl2YWxlbnRzIG9mIFRWTV9TRVRJVEVNIG1lc3NhZ2UgKHByb2JhYmx5IHNv
bWUgbWV0aG9kIG9mIFRyZWVOb2RlKD8pIG9iamVjdCkgYW5kIFRWSVNfQk9MRCBjb25zdGFudCAo
PSZoMTA9MTYpLg==


Re: Uncheck child nodes if parent node is unchecked in treeview by JonathanBrown

JonathanBrown
Sun Oct 12 10:27:01 CDT 2008

Could you explain a little more about your number 2 line? Is that supposed
to make any parent node bold if it contains child nodes? How would I use
that? Which event would I put that in?

"st" wrote:

> "Jonathan Brown" <JonathanBrown@discussions.microsoft.com> Ñ?ообÑ?ил/Ñ?ообÑ?ила в новоÑ?Ñ?Ñ?Ñ? Ñ?ледÑ?Ñ?Ñ?ее: news:45A175E7-9505-4D67-8900-0F6ACA884757@microsoft.com...
> >> I'm trying to use a Treeview control. I'd like to have all child nodes be
> >> automatically unchecked if a if I uncheck a parent node. Also, is there a
> >> way to specify that if a node contains child nodes it'll automatically be
> >> bold?
>
> 1. You need to iterate the collection of children of the node being unchecked and uncheck each of them individually.
>
> 2. Yes, of course. 'Or' TVIS_BOLD constant to item style when adding it's children. Check Object Browser ([F2] key in VB) to see VB equivalents of TVM_SETITEM message (probably some method of TreeNode(?) object) and TVIS_BOLD constant (=&h10=16)