Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Treeview with recursive checkboxes?

Posted on 2000-03-13
7
Medium Priority
?
491 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 400 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

604 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