Solved

finding the parent

Posted on 2001-07-21
3
236 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 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

23 Experts available now in Live!

Get 1:1 Help Now