Solved

Adding component selection to your created component's object inspector

Posted on 2002-04-17
5
264 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
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…

762 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