?
Solved

finding the parent

Posted on 2001-07-21
3
Medium Priority
?
250 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 400 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and 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 The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Screencast - Getting to Know the Pipeline
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

850 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