Solved

TreeView ... Working with...

Posted on 2001-08-23
2
167 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 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

708 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

17 Experts available now in Live!

Get 1:1 Help Now