Solved

Adding component selection to your created component's object inspector

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

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi selector screen 2 80
Why can't I create any project with my delphi EXE file? 6 26
Delphi inherited method 6 70
Graphics32 under Delphi 10.1 Berlin 2 68
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 I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

821 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