?
Solved

finding the parent

Posted on 2001-07-21
3
Medium Priority
?
246 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
[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
  • 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

Technology Partners: 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!

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

764 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