Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

New component question

Posted on 2004-08-19
4
Medium Priority
?
161 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
[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
4 Comments
 
LVL 13

Accepted Solution

by:
BlackTigerX earned 150 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)
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
ID: 11841587
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
ID: 11842048
property  Tag1: Integer read FTag1 write FTag1;
property   Tag2: Integer read FTag2 write FTag2;

Shane
0
 
LVL 13

Expert Comment

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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

722 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