?
Solved

TreeView ... Working with...

Posted on 2001-08-23
2
Medium Priority
?
215 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 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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 I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

719 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