Solved

Treeview with recursive checkboxes?

Posted on 2000-03-13
7
483 Views
Last Modified: 2008-02-26
HI, I am looking for a treeviewcomponent where you can enable checkboxes and they act recursive. I mean when you check the parent all the childnodes get checked as wel and visa versa. Anyone formiliar whit such a component?
0
Comment
Question by:corpa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 12

Expert Comment

by:rwilson032697
ID: 2613488
You could use this one: http://www.lischke-online.de/TreeNT.html

It doesn't do the resursive action, but it is easy enough to do.

Cheers,

Raymond.
0
 
LVL 10

Accepted Solution

by:
Lischke earned 100 total points
ID: 2615238
Well, Ray is right in that my TreeNT supports checkboxes, but is wrong about the recursive behaviour. Setting the check kind to tri-state causes dependent nodes (children or parents or both, whatever applies) to track check state changes of a node.

Ciao, Mike
0
 
LVL 1

Expert Comment

by:AttarSoftware
ID: 2615503
ooOOooOOooOOooOOoo ;O)

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:corpa
ID: 2617556
Hello Mike,

I've added the following in the onchecked event and it works just fine.

procedure TForm1.TreeNT1Checked(Sender: TObject; Node: TTreeNTNode);
var t : integer;
begin
  if node.HasChildren then
   begin
    for t := 0 to Node.Count-1 do
     begin
       Node.Item[t].CheckState := csChecked;
     end;
   end;
end;

So my problem is solved.
Since it is your component i'd like to give you the credits.
Thanks alot,
Pascal
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 2618012
Mike - I'm sure TTreeNT won't do this recursive behaviour itself, will it? (ie: You need to right the handler above as I suggested...)

Cheers,

Raymond.
0
 
LVL 10

Expert Comment

by:Lischke
ID: 2618918
Well, the check concept is admittedly difficult to understand but it is as I said. When a node's check kind is tri-state (ctCheckboxGrayed), then changes to it are propagated down to all its children and up to its parent. Both ways are recursive. See also CheckParentCheckState for up-propagation and line 2122 ff. (method TTreeNTNode.SetCheckState) in TreeNT.pas (version 3.1 from Nov last year) for down propagation.

Ciao, Mike
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 2621162
Hi Mike,

Yes, I had a poke around in the source before I posted the comment. I saw what you mean about the tri-state behaviour...

Anyway, enough of this! TTreeNT rules OK! ;-)

Cheers,

Raymond.

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question