Solved

Treeview with recursive checkboxes?

Posted on 2000-03-13
7
482 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
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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

829 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