Solved

New component question

Posted on 2004-08-19
4
154 Views
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?

Don
P.S. Marco Cantu's book shows how to use my new Ttreenode in the TreeView.Add function.
0
Comment
Question by:d32coder
  • 2
4 Comments
 
LVL 13

Accepted Solution

by:
BlackTigerX earned 50 total points
Comment Utility
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)
private
  FYourNewProperty:Integer;
public
published
  YourNewProperty:Integer read FYourNewProperty write FYourNewProperty;
end;

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

Author Comment

by:d32coder
Comment Utility
I plugged this snippet into my project...


TdsTreeNode = class(TTreeNode)
private
  FTag1: Integer;
  FTag2: Integer;
public
published
  Tag1: Integer read FTag1 write FTag1;
  Tag2: Integer read FTag2 write FTag2;
end;

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

Don
0
 
LVL 11

Expert Comment

by:shaneholmes
Comment Utility
property  Tag1: Integer read FTag1 write FTag1;
property   Tag2: Integer read FTag2 write FTag2;

Shane
0
 
LVL 13

Expert Comment

by:BlackTigerX
Comment Utility
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
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

771 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

14 Experts available now in Live!

Get 1:1 Help Now