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
Solved

Adding component selection to your created component's object inspector

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

840 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