Board index » Visual Studio » still fighting with VB6 now Checkboxes in a TreeView Control???

still fighting with VB6 now Checkboxes in a TreeView Control???

Visual Studio294
Hi



I'm still on VB6.



What I'm trying to implement is similar functionality

as the tree view used (for example) in Microsoft Backup

(from Win98).



I have it working good with checkboxes, icons for open

and closed dir's ect.

Now all I want to do (and I'd be soo happy...!), is to be

able to dim the checkboxes higher up in the tree when

one lower down is checked (like Backup does).



eg.

Check a box and all boxes below it are checked, and

all boxes upwards towards the root in the chain become

'dimly checked' showing partial selection of those

particular nodes.



I can't find any means of isolating one node in the tree

and causing the 'checks' to be dimmed or change color.

Properties provided such as ForeColor, Bold ect. do not

act on the boxes.



Any body have any ideas??

I'm not worried about the logic for the tree, only getting

hold of a reference to the Node object's checkbox and

changing its color.



I realize it could be complicated, so just send me in

the right direction, assuming of course it's even possible.



Hate to have to start building a tree from scratch just to get

the ability to individualy dim a checkbox.



David Otte


-
 

Re:still fighting with VB6 now Checkboxes in a TreeView Control???

Try setting the checkbox value to 2. e.g.



Check1 = 0 ' unchecked

Check1 = 1 ' checked (dark)

Check1 = 2 ' semi-checked (greyed)



"David" wrote:



Quote
Hi



I'm still on VB6.



What I'm trying to implement is similar functionality

as the tree view used (for example) in Microsoft Backup

(from Win98).



I have it working good with checkboxes, icons for open

and closed dir's ect.

Now all I want to do (and I'd be soo happy...!), is to be

able to dim the checkboxes higher up in the tree when

one lower down is checked (like Backup does).



eg.

Check a box and all boxes below it are checked, and

all boxes upwards towards the root in the chain become

'dimly checked' showing partial selection of those

particular nodes.



I can't find any means of isolating one node in the tree

and causing the 'checks' to be dimmed or change color.

Properties provided such as ForeColor, Bold ect. do not

act on the boxes.



Any body have any ideas??

I'm not worried about the logic for the tree, only getting

hold of a reference to the Node object's checkbox and

changing its color.



I realize it could be complicated, so just send me in

the right direction, assuming of course it's even possible.



Hate to have to start building a tree from scratch just to get

the ability to individualy dim a checkbox.



David Otte







-

Re:still fighting with VB6 now Checkboxes in a TreeView Control???

nevermind my last post, sorry, I didn't read far enough.



"David" wrote:



Quote
Hi



I'm still on VB6.



What I'm trying to implement is similar functionality

as the tree view used (for example) in Microsoft Backup

(from Win98).



I have it working good with checkboxes, icons for open

and closed dir's ect.

Now all I want to do (and I'd be soo happy...!), is to be

able to dim the checkboxes higher up in the tree when

one lower down is checked (like Backup does).



eg.

Check a box and all boxes below it are checked, and

all boxes upwards towards the root in the chain become

'dimly checked' showing partial selection of those

particular nodes.



I can't find any means of isolating one node in the tree

and causing the 'checks' to be dimmed or change color.

Properties provided such as ForeColor, Bold ect. do not

act on the boxes.



Any body have any ideas??

I'm not worried about the logic for the tree, only getting

hold of a reference to the Node object's checkbox and

changing its color.



I realize it could be complicated, so just send me in

the right direction, assuming of course it's even possible.



Hate to have to start building a tree from scratch just to get

the ability to individualy dim a checkbox.



David Otte







-

Re:still fighting with VB6 now Checkboxes in a TreeView Control???

I believe the only way to do this with the common dialog treeview is through

subclassing. You might be able to find an example on www.vbaccelerator.com.

We had a similar dilemma at my office and decided just to make the treenode

text bold when a child item was checked.



Hope that helps,



Jeff Beem



"Charlie" wrote:



Quote
nevermind my last post, sorry, I didn't read far enough.



"David" wrote:



>Hi

>

>I'm still on VB6.

>

>What I'm trying to implement is similar functionality

>as the tree view used (for example) in Microsoft Backup

>(from Win98).

>

>I have it working good with checkboxes, icons for open

>and closed dir's ect.

>Now all I want to do (and I'd be soo happy...!), is to be

>able to dim the checkboxes higher up in the tree when

>one lower down is checked (like Backup does).

>

>eg.

>Check a box and all boxes below it are checked, and

>all boxes upwards towards the root in the chain become

>'dimly checked' showing partial selection of those

>particular nodes.

>

>I can't find any means of isolating one node in the tree

>and causing the 'checks' to be dimmed or change color.

>Properties provided such as ForeColor, Bold ect. do not

>act on the boxes.

>

>Any body have any ideas??

>I'm not worried about the logic for the tree, only getting

>hold of a reference to the Node object's checkbox and

>changing its color.

>

>I realize it could be complicated, so just send me in

>the right direction, assuming of course it's even possible.

>

>Hate to have to start building a tree from scratch just to get

>the ability to individualy dim a checkbox.

>

>David Otte

>

>

>

-

Re:still fighting with VB6 now Checkboxes in a TreeView Control???



"Jeff Beem" <JeffBeem@discussions.microsoft.com>wrote in message

Quote
I believe the only way to do this with the common dialog treeview is

through

subclassing. You might be able to find an example on

www.vbaccelerator.com.

We had a similar dilemma at my office and decided just to make the

treenode

text bold when a child item was checked.



That's exactly the same bottom line I came to as well.......

(just still kinda bugs me when I can't make it do what I want

though.......)



Oh well..... I guess it'll be back to a couple of months digging around

in VB subclassing.....



Thanks for the reply.



David



Quote


Hope that helps,



Jeff Beem



"Charlie" wrote:



>nevermind my last post, sorry, I didn't read far enough.

>

>"David" wrote:

>

>>Hi

>>

>>I'm still on VB6.

>>

>>What I'm trying to implement is similar functionality

>>as the tree view used (for example) in Microsoft Backup

>>(from Win98).

>>

>>I have it working good with checkboxes, icons for open

>>and closed dir's ect.

>>Now all I want to do (and I'd be soo happy...!), is to be

>>able to dim the checkboxes higher up in the tree when

>>one lower down is checked (like Backup does).

>>

>>eg.

>>Check a box and all boxes below it are checked, and

>>all boxes upwards towards the root in the chain become

>>'dimly checked' showing partial selection of those

>>particular nodes.

>>

>>I can't find any means of isolating one node in the tree

>>and causing the 'checks' to be dimmed or change color.

>>Properties provided such as ForeColor, Bold ect. do not

>>act on the boxes.

>>

>>Any body have any ideas??

>>I'm not worried about the logic for the tree, only getting

>>hold of a reference to the Node object's checkbox and

>>changing its color.

>>

>>I realize it could be complicated, so just send me in

>>the right direction, assuming of course it's even possible.

>>

>>Hate to have to start building a tree from scratch just to get

>>the ability to individualy dim a checkbox.

>>

>>David Otte

>>

>>

>>





-

Re:still fighting with VB6 now Checkboxes in a TreeView Control???

this might interest you (careful of line-wrap):



www.vbaccelerator.com/home/VB/Code/Controls/TreeView/Hierarchy_Selector_Control/article.asp">www.vbaccelerator.com/home/VB/Code/Controls/TreeView/Hierarchy_Selector_Control/article.asp





Jeff Beem





"David" wrote:



Quote


"Jeff Beem" <JeffBeem@discussions.microsoft.com>wrote in message

news:4810291E-AF50-40EB-BD86-5690BB81CC90@microsoft.com...

>I believe the only way to do this with the common dialog treeview is

through

>subclassing. You might be able to find an example on

www.vbaccelerator.com.

>We had a similar dilemma at my office and decided just to make the

treenode

>text bold when a child item was checked.



That's exactly the same bottom line I came to as well.......

(just still kinda bugs me when I can't make it do what I want

though.......)



Oh well..... I guess it'll be back to a couple of months digging around

in VB subclassing.....



Thanks for the reply.



David



>

>Hope that helps,

>

>Jeff Beem

>

>"Charlie" wrote:

>

>>nevermind my last post, sorry, I didn't read far enough.

>>

>>"David" wrote:

>>

>>>Hi

>>>

>>>I'm still on VB6.

>>>

>>>What I'm trying to implement is similar functionality

>>>as the tree view used (for example) in Microsoft Backup

>>>(from Win98).

>>>

>>>I have it working good with checkboxes, icons for open

>>>and closed dir's ect.

>>>Now all I want to do (and I'd be soo happy...!), is to be

>>>able to dim the checkboxes higher up in the tree when

>>>one lower down is checked (like Backup does).

>>>

>>>eg.

>>>Check a box and all boxes below it are checked, and

>>>all boxes upwards towards the root in the chain become

>>>'dimly checked' showing partial selection of those

>>>particular nodes.

>>>

>>>I can't find any means of isolating one node in the tree

>>>and causing the 'checks' to be dimmed or change color.

>>>Properties provided such as ForeColor, Bold ect. do not

>>>act on the boxes.

>>>

>>>Any body have any ideas??

>>>I'm not worried about the logic for the tree, only getting

>>>hold of a reference to the Node object's checkbox and

>>>changing its color.

>>>

>>>I realize it could be complicated, so just send me in

>>>the right direction, assuming of course it's even possible.

>>>

>>>Hate to have to start building a tree from scratch just to get

>>>the ability to individualy dim a checkbox.

>>>

>>>David Otte

>>>

>>>

>>>







-

Re:still fighting with VB6 now Checkboxes in a TreeView Control???

"David" <nodeo@sk.sympatico.ca>wrote in message

Quote


That's exactly the same bottom line I came to as well.......

(just still kinda bugs me when I can't make it do what I want

though.......)



Oh well..... I guess it'll be back to a couple of months digging around

in VB subclassing.....



Thanks for the reply.



David



You can always dump the icons you're currently using, along with the

treeview checkboxes and create some icons that look like checkboxes

(including one that's "dimmed") and use those for checkboxes.... or, use the

same control that the backup app does.... which is a SysTreeview32. There

should be some code out there somewhere to do that.





-

Re:still fighting with VB6 now Checkboxes in a TreeView Control???



"Jeff Beem" <JeffBeem@discussions.microsoft.com>wrote in message

I can't get the thing to compile (or even load the project) but that's par

for the course for me. I'll

get it with a bit of work, but they included a test .exe with the source,

and that works, so I can see

what it does.



The code is pretty complex. Apparantly they create an image and overlay it

on the TreeView

(and scroll it with the tree).

Judging from the amount of code it took (much of it I'll have to study for a

while), I'm starting to

think a guy would be better off to start creating a TreeView from scratch.

A few control arrays,

a couple of icons, and a lot of code in the resizing event and voila.......!

(well, ... maybe I'll have to think about that one for a while...).



Also, there is Ken Halter's suggestion. Maybe the VC++ version stuck in an

ActiveX control

might work, I'm not quite sure yet.



Some things to think about.



Thanks for the link....I searched a long time and got bogged down in

thousands of examples

of the TreeView showing regular usage... I couldn't find a thing.....



David Otte



Quote
Jeff Beem





"David" wrote:



>

>"Jeff Beem" <JeffBeem@discussions.microsoft.com>wrote in message

>news:4810291E-AF50-40EB-BD86-5690BB81CC90@microsoft.com...

>>I believe the only way to do this with the common dialog treeview is

>through

>>subclassing. You might be able to find an example on

>www.vbaccelerator.com.

>>We had a similar dilemma at my office and decided just to make the

>treenode

>>text bold when a child item was checked.

>

>That's exactly the same bottom line I came to as well.......

>(just still kinda bugs me when I can't make it do what I want

>though.......)

>

>Oh well..... I guess it'll be back to a couple of months digging around

>in VB subclassing.....

>

>Thanks for the reply.

>

>David

>

>>

>>Hope that helps,

>>

>>Jeff Beem

>>

>>"Charlie" wrote:

>>

>>>nevermind my last post, sorry, I didn't read far enough.

>>>

>>>"David" wrote:

>>>

>>>>Hi

>>>>

>>>>I'm still on VB6.

>>>>

>>>>What I'm trying to implement is similar functionality

>>>>as the tree view used (for example) in Microsoft Backup

>>>>(from Win98).

>>>>

>>>>I have it working good with checkboxes, icons for open

>>>>and closed dir's ect.

>>>>Now all I want to do (and I'd be soo happy...!), is to be

>>>>able to dim the checkboxes higher up in the tree when

>>>>one lower down is checked (like Backup does).

>>>>

>>>>eg.

>>>>Check a box and all boxes below it are checked, and

>>>>all boxes upwards towards the root in the chain become

>>>>'dimly checked' showing partial selection of those

>>>>particular nodes.

>>>>

>>>>I can't find any means of isolating one node in the tree

>>>>and causing the 'checks' to be dimmed or change color.

>>>>Properties provided such as ForeColor, Bold ect. do not

>>>>act on the boxes.

>>>>

>>>>Any body have any ideas??

>>>>I'm not worried about the logic for the tree, only getting

>>>>hold of a reference to the Node object's checkbox and

>>>>changing its color.

>>>>

>>>>I realize it could be complicated, so just send me in

>>>>the right direction, assuming of course it's even possible.

>>>>

>>>>Hate to have to start building a tree from scratch just to get

>>>>the ability to individualy dim a checkbox.

>>>>

>>>>David Otte

>>>>

>>>>

>>>>

>

>

>





-

Re:still fighting with VB6 now Checkboxes in a TreeView Control???



"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com>wrote in message

Quote
"David" <nodeo@sk.sympatico.ca>wrote in message

news:420afdb6$0$10017$45beb828@newscene.com...

>

>That's exactly the same bottom line I came to as well.......

>(just still kinda bugs me when I can't make it do what I want

>though.......)

>

>Oh well..... I guess it'll be back to a couple of months digging around

>in VB subclassing.....

>

>Thanks for the reply.

>

>David



You can always dump the icons you're currently using, along with the

treeview checkboxes and create some icons that look like checkboxes

(including one that's "dimmed") and use those for checkboxes.... or, use

the

same control that the backup app does.... which is a SysTreeview32. There

should be some code out there somewhere to do that.





Good idea!



I had kind of thought about that, but I didn't realize how much difference

there

actually is between the two controls (or the class and control I believe it

is).

I kinda assumed they would be about the same functionality.

Looking at them now, there's quite a bit of difference.



If it turns out it can be made to do what I need, I could subclass it in an

ActiveX control and use it directly in the VB app..... (it's an idea

anyway....).



Thanks for the hint.



David Otte



Quote






-

Re:still fighting with VB6 now Checkboxes in a TreeView Control???

"David" <nodeo@sk.sympatico.ca>wrote in message

Quote
>

.... well.....I'll be damned!

I can't get the thing to compile (or even load the project) but that's par

for the course for me. I'll

get it with a bit of work, but they included a test .exe with the source,

and that works, so I can see

what it does.



The code is pretty complex. Apparantly they create an image and overlay

it



There's a *lot* of great code on that site. The "trick" to getting stuff to

run there is to make sure that all dependencies are present and registered

first. Since his subclasser uses the Implements keyword, if it's missing or

not registered, VB takes forever and a day to load the project and (try to)

resolve the problem. It also looks like you need the OleGuids.Tlb typelib to

work with the control in the IDE (doesn't say so but it's fairly common in

his samples and it's listed in the Related section)



The good news is.... once you get a hand full of his dependencies tucked

away in a folder somewhere and registered, the samples load and run great

with very few problems. One thing about his subclasser. There are several

components there that require his VB5 version so you might as well grab that

and make sure it's registered as well. Once you load the code, you can reset

the references to the VB6 version if you want.



One last thing about samples there... if you want to do the work, you can

incorporate the subclasser and any other component there, directly into your

project so there's no external dependencies. That should be the last step

though because subclassers tend to crash in the IDE.... which is why having

a separate dll is better for the majority of the development work.



--

Ken Halter - MS-MVP-VB - www.vbsight.com">www.vbsight.com

Please keep all discussions in the groups..





-

Re:still fighting with VB6 now Checkboxes in a TreeView Control???



"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com>wrote in message

Quote
"David" <nodeo@sk.sympatico.ca>wrote in message

news:420c5243$0$12314$45beb828@newscene.com...

>>

>.... well.....I'll be damned!

>I can't get the thing to compile (or even load the project) but that's

par

>for the course for me. I'll

>get it with a bit of work, but they included a test .exe with the

source,

>and that works, so I can see

>what it does.

>

>The code is pretty complex. Apparantly they create an image and overlay

>it



There's a *lot* of great code on that site. The "trick" to getting stuff

to

run there is to make sure that all dependencies are present and registered

first. Since his subclasser uses the Implements keyword, if it's missing

or

not registered, VB takes forever and a day to load the project and (try

to)

resolve the problem. It also looks like you need the OleGuids.Tlb typelib

to

work with the control in the IDE (doesn't say so but it's fairly common in

his samples and it's listed in the Related section)



The good news is.... once you get a hand full of his dependencies tucked

away in a folder somewhere and registered, the samples load and run great

with very few problems.



Got it...! Thanks!

That particular project just needed the two... VB6 sublclasser and OleGuids.

(Some odd behaviour at first, but probably because of the order I did

things..)



A bit of an 'information overload' to try and determine if it's excatly what

I want,

but it sure looks a lot less intimidating inside the IDE than it did in

Notepad.....



The project has now become more of a 'challenge', like a 'better mousetrap',

than it is an urgent neccesity for me, so I can take some time to look at

what

they're doing (the control doesn't just do that one thing..... it does quite

a bit

of other stuff as well...).



It appears at first glance that it replaces the 'icon' with its own, as you

had

suggested (I'm a bit reluctant to yap much about it though until I've

studied

it a bit better).

The limitation I see there is that it might be difficult to determine when

the

checkbox (alone) has been 'clicked' as opposed to the row. This might

not be a big problem in a practical situation, however, in my tireless

search

for more perfect'er solutions I do believe my quest might just still be

ongoing........

(.... and 'fussy' has 'P*** all' to do with it too....heh heh...!( just in

case

somebody out there reading this was thinking that...)).



Thanks again for the extra help in loading the thing.

(there's invaluable info in all of it)



David Otte



Quote
One thing about his subclasser. There are several

components there that require his VB5 version so you might as well grab

that

and make sure it's registered as well. Once you load the code, you can

reset

the references to the VB6 version if you want.



One last thing about samples there... if you want to do the work, you can

incorporate the subclasser and any other component there, directly into

your

project so there's no external dependencies. That should be the last step

though because subclassers tend to crash in the IDE.... which is why

having

a separate dll is better for the majority of the development work.



--

Ken Halter - MS-MVP-VB - www.vbsight.com">www.vbsight.com

Please keep all discussions in the groups..









-