Solved

finding the parent

Posted on 2001-07-21
3
237 Views
Last Modified: 2012-05-04
How can i find the parent of a child node in a treeview in delphi 2?
0
Comment
Question by:Xperl
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
DidierD earned 100 total points
ID: 6304473
Hi,

Put a TTreeView, a TButton and a TEdit on a form and add some items to the treeview. Add the code below to the button. Run it, select a node and press the button. The text of the parent node will appear in the editbox.

procedure TForm1.Button1Click(Sender: TObject);
var
  SelNode: TTreeNode;
  ParentNode: TTreeNode;
begin
  SelNode := TreeView1.Selected;
  ParentNode := SelNode.Parent;
  edit1.Text := ParentNode.Text;
end;

Didier
0
 
LVL 2

Expert Comment

by:DidierD
ID: 6304475
I'm using Delphi 5, but i think it is the same for Delphi 2

Didier
0
 

Author Comment

by:Xperl
ID: 6304567
Thanks DidierD.  That code did the trick, ta.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

867 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now