Solved

Adding component selection to your created component's object inspector

Posted on 2002-04-17
5
265 Views
Last Modified: 2010-04-04
I am creating a component, and one of the published properities (to show up in the object inspector) needs to be a drop-down selection box that is populated with all of the TTable components on the current form.  I tried looking at the .pas files for some of the standard VCL components that do this, but I couldnt follow all of the code.

Any thoughts  on how to do this?
chmod101
0
Comment
Question by:chmod101
  • 2
  • 2
5 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6947778
marker for coming back later . . .
0
 
LVL 10

Expert Comment

by:Jacco
ID: 6948131
Normally you don't have to do anything for that.

TComponentProperty does all that for you.

The property must be in the published section of the component.

Regards Jacco

(I am verifying this at the moment)
0
 
LVL 10

Accepted Solution

by:
Jacco earned 35 total points
ID: 6948145
The following code tested OK with what I said on D5. What might be the problem is the name of your property (some property editors are registers only by name and work for all classes). Can you give us the name of the property and your version of Delphi?

unit Test;

interface

uses
  Classes, Db, DbTables;

type
  TMyComp = class(TComponent)
  private
    fTable: TTable;
  published
    property Table: TTable read fTable write fTable;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Jacco', [TMyComp]);
end;

end.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6948338
yep, i thought this,
but didn't had the time for a check
0
 

Author Comment

by:chmod101
ID: 6962851
Thanks Jacco,

I haven't done anything  like this before, so I didn't know that you could just declare the property as a TTable property, and that Delphi would automatically populate a listing of all TTables available.

Thanks for the help.
chmod101
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

943 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

5 Experts available now in Live!

Get 1:1 Help Now