Link to home
Start Free TrialLog in
Avatar of sylvainl
sylvainl

asked on

How can I make a Treeview with multi-checkbox selection

I like very much the treeview object, but I would like to add one additionnal
feature to it.  Imagine a regular treeview with expand and collapse icons.
When you select one or multiple nodes, you have an additionnal checkbox icon beside
the expand and collapse.  So you can save only those selected with the checkbox.

 [  ]-[+]-Project 1
       |
 [X]-[-]-Project 2
          |
        [  ]-[+]-Application 1
               |
        [X]-[-]-Application 2      
Avatar of sylvainl
sylvainl

ASKER

Edited text of question
Hi sylvainl:
That's not an easy question. You would have to create a new component derived out of TCustomTreeView, and modify the TTreeNode object. Adding the property TTreeNode.Checked isn't verry difficult but adding the graphic capabileties sertainly demands attention.
I'll see what I can do, if I have the time :)

The TTreeView component supports another image which should work.  Look up "StateImages" in the help file.  From Delphi's help file: "The state image appears as an additional image to the left of the item's icon."

Cheers,
JB
You don't have to make them yourself - there are already some trees like this:

http://bes.trendline.co.il/torry/vcl/lbcb/chkoutl.zip
"Checkoutline is just the same as the standard outline control, but has the ability to check the items."

http://bes.trendline.co.il/torry/vcl/lbcb/mstree.zip
"A TreeView that is capable of multi-selecting." (Can be the same as checkboxes...)

http://bes.trendline.co.il/torry/vcl/lbcb/treent10.zip
"TreeNT is much enhanced treeview control, which is really fast and has many new features like checkboxes, auto scrolling, hot tracking, single expand, node hints and much more."
http://bes.trendline.co.il/torry/vcl/lbcb/outlplus.exe
"Allows you to specify different glyphs for each node in the outline."
Hi all ... everything is said at the moment.
I would just make a glyph of a checkbox and use an overlay of a check.  Check out TImageList and overlays...

Rick
ASKER CERTIFIED SOLUTION
Avatar of Lischke
Lischke

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Mike, I guess component writrers have their fans too ;-) So I'm one. Good thing someone plants trees here :)
Hi Matvey,

I'm pleased to read that...:-) Well, TreeNT is going to be used in lots of (even commercial) products soon. BTW: Version 2.1 is almost ready. If anyone wants a free copy, just send a mail...

Ciao, Mike
Sure, I'd love to receive the new ver. Have you seen the Eugine Mayevski tree? BWPack? A good one too. I know it because I know Eugine... (http://bes.trendline.co.il/torry/vcl/packs/bwpack.zip)

bosism@netvision.net.il (my email)
Mike, can you send a demo too? Tom.Deprez@uz.kuleuven.ac.be 10x!
Zif, Mike, the BWPack also contains lots of cool stuff, a tree I mean. My advice...
thanks, matvey, I'll a look.
Matvey, ZifNab,

the code is on the way to your mail addresses.

I'd also a lokk at the BWPack, but the tree is without source, so it is not useful for me.

Ciao, Mike
Thank you very much Lischke.

Forgot to mention... Somebody already looked at the TeeTree? New component form TeeChart? Zif.
Thanks! I'll look at it right away.

BWPack - I think it's with sources. You can email the author of course if there are no sources inside - what's the reason to hide them if it's freeware anyway?