Solved

TreeView ... Working with...

Posted on 2001-08-23
2
206 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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…
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses
Course of the Month4 days, 23 hours left to enroll

636 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