Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

TreeView ... Working with...

Posted on 2001-08-23
2
Medium Priority
?
221 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
2 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 300 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

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…
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…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

972 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