BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Finding components at design time

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing
View previous topic :: View next topic  
Author Message
Simon Hooper
Guest





PostPosted: Tue Nov 04, 2003 9:02 am    Post subject: Finding components at design time Reply with 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.

Thanks in advance
Simon


Back to top
Marc Rohloff
Guest





PostPosted: Tue Nov 04, 2003 12:55 pm    Post subject: Re: Finding components at design time Reply with quote



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





PostPosted: Tue Nov 04, 2003 5:25 pm    Post subject: Re: Finding components at design time Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.