New component question

Posted on 2004-08-19
Last Modified: 2010-04-05
OK, I'm a total novice at creating components.

I want to create a custom TTreeNode.   I really only need to add a few properties to the existing type.

In D6, I click on NEW COMPONENT and choose an ancestor class but TTreenode isn't listed, though TTreeView is (dont need that).

What method can I use to get the TTreenode code and inherit it so I can create my new TdsTreeNode?

P.S. Marco Cantu's book shows how to use my new Ttreenode in the TreeView.Add function.
Question by:d32coder
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
LVL 13

Accepted Solution

BlackTigerX earned 50 total points
ID: 11841126
see... TreeNode is not a component, is just a class, so if you want to derive from that you have to do it from code:

something like this:

TdsTreeNode = class(TTreeNode)
  YourNewProperty:Integer read FYourNewProperty write FYourNewProperty;

then you could add a TdsTreeNode to a TreeView by code just as you would add a TreeNode, but referencing your TdsTreeNode type instead

Author Comment

ID: 11841587
I plugged this snippet into my project...

TdsTreeNode = class(TTreeNode)
  FTag1: Integer;
  FTag2: Integer;
  Tag1: Integer read FTag1 write FTag1;
  Tag2: Integer read FTag2 write FTag2;

On compile I get an error
  Published Field 'Tag1' not a class nor an interface type.
I wish I knew more about this.  

LVL 11

Expert Comment

ID: 11842048
property  Tag1: Integer read FTag1 write FTag1;
property   Tag2: Integer read FTag2 write FTag2;

LVL 13

Expert Comment

ID: 11842168
yes, sorry, I missed the property part

and it doesn't have to be in the published part, it can just be public
published is for components

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

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…
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…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses
Course of the Month9 days, 19 hours left to enroll

624 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