Solved

TreeView ... Working with...

Posted on 2001-08-23
2
200 Views
Last Modified: 2010-04-06
Hi !
I'm using delphi 5 Enterprise with Win98SE and WinNT4.0.
I'm testing a bit with the TreeView-Control...
I want to have a directory-structure with node-texts like "Ingos directory". With a doubleclick then i want to put the real content (for example "c:\ingo") into an edit-field...
I'm not looking for a complete source-code. I only want to know what's the property for the text i see when opening the TreeView (for example "ingos directory") and where i can put the real value (for example "c:\ingo"). How can i put this value at least into the edit-field? I got error-messages like "TreeNode and String isn't compatible...". What i have to redefine here?
Thanks a lot for your help!
Best regards,
Ingo
 
0
Comment
Question by:Ogni
[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 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 100 total points
ID: 6417528
type TNodeDataRec = Record
                      RealName : String[100];
                      //..maybe more attributes
                    end;
     PNodeDataRec = ^TNodeDataRec;

somewhere on adding the nodes
 
var
  NodeData : PNodeDataRec;
  ANode    : TTreeNode;
begin
  ANode := TreeView1.Items.Add(Nil,'Ingos directory');
  NodeData := New(PNodeDataRec);
  NodeData^.RealName := 'C:\ingo';
  ANode.Data := NodeData;
  ...
end;

on doubleClick-event

var
  ANode : TTreeNode;
  NodeData : PNodeDataRec;
begin
  ANode := TreeView1.Selected;
  If (Assigned(ANode)) and (Assigned(ANode.Data)) then
    ShowMessage(PNodeDataRec(ANode.Data)^.RealName);
    //or something other
end;

on the on-delete event

If Assigned(Node.Data) then  
  Dispose(PNodeDataRec(ANode.Data));  //free memors

-----

well just in short in just from head,
(typos and mismatches may possible, because untested)

meikl ;-)
 
0
 

Author Comment

by:Ogni
ID: 6417600
Quick answer - quick points ;-)
Thanks a lot!!!
Ingo
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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

751 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