 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Simon Hooper Guest
|
Posted: Tue Nov 04, 2003 9:02 am Post subject: Finding components at design time |
|
|
I have written a new component. When I put one on a form in the IDE I want
to search the project for any instances of another component class and
thereafter take some action. How can I find all instances of a component
class at design time?
The object inspector for TDatasource lists all TDatasets from all
forms in the uses clause, whether those units are opened for editing or not,
so I figure
that it must be possible.
Thanks in advance
Simon
|
|
| Back to top |
|
 |
Marc Rohloff Guest
|
Posted: Tue Nov 04, 2003 12:55 pm Post subject: Re: Finding components at design time |
|
|
On Tue, 4 Nov 2003 09:02:24 -0000, Simon Hooper<simon (AT) simonhooper (DOT) co.uk>
said ...
| Quote: | I have written a new component. When I put one on a form in the IDE I want
to search the project for any instances of another component class and
thereafter take some action. How can I find all instances of a component
class at design time?
The object inspector for TDatasource lists all TDatasets from all
forms in the uses clause, whether those units are opened for editing or not,
so I figure
that it must be possible.
|
Any property which references a TComponent descendant generates this list
automatically in the drop-down. If you look at
TComponentProperty.GetValues (in DesignEditors) you can see that this
basically comes down to:
Designer.GetComponentNames(TypeData, CallbackProc);
You should just be able to use the built in functionality. Is there any
reason this is not sufficient?
Marc
|
|
| Back to top |
|
 |
Simon Hooper Guest
|
Posted: Tue Nov 04, 2003 5:25 pm Post subject: Re: Finding components at design time |
|
|
Thanks Marc,
Designer.GetComponentNames and other methods of IDesigner look really
useful.
Can I get hold of the designer interface in the constructor, rather than a
component editor?
Something like:
constructor TMyComponent.Create(AOwner: TComponent);
begin
inherited;
if (csDesigning in ComponentState) then
Designer..........................
end;
Simon
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|