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 

Re: Afterclonsturction method or ?

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





PostPosted: Wed Oct 08, 2003 4:41 am    Post subject: Re: Afterclonsturction method or ? Reply with quote



Hello, Ross!
You wrote on Tue, 07 Oct 2003 21:27:37 -0700:
Quote:
Can I override the afterconstruction method?

No, that's still too early. Overload .Loaded instead.

Cheers,
Ignacio



Back to top
Jens Gruschel
Guest





PostPosted: Thu Oct 09, 2003 12:01 pm    Post subject: Re: Afterclonsturction method or ? Reply with quote



Quote:
No, that's still too early. Overload .Loaded instead.

But remember that Loaded is not called when the component is created at
runtime (not loaded from stream). If you need certain properties to be set
before you do something, why don't you simply write setter procedures for
that properties?

Jens




Back to top
Jens Gruschel
Guest





PostPosted: Tue Oct 14, 2003 9:23 pm    Post subject: Re: Afterclonsturction method or ? Reply with quote



Quote:
But remember that Loaded is not called when the component is created at
runtime (not loaded from stream). If you need certain properties to be
set
before you do something, why don't you simply write setter procedures for
that properties?

My component has a registry component that reads and writes to the
registry as
one of its properties. Until the registry component is loaded I can't use
it to
read in the properties.

I see. Probably you do not plan to create the component at runtime. But if
you do so, something like this might help (of course I do not know how
exactly your components work):

procedure TMyComponent.Loaded;
begin
inherited;
if FRegistryComponent <> nil then
FRegistryComponent.Load(Self); // load values from registry after all
components (including FRegistryComponent) are loaded
end;

procedure TMyComponent.SetRegistryComponent(Value: TMyRegistryComponent);
begin
if (FRegistryComponent <> Value) then begin
FRegistryComponent := Value;
if (FRegistryComponent <> nil) and not (csLoading in ComponentState)
then
FRegistryComponent.Load(Self); // load values from registry if
component is created at runtime and/or RegistryComponent property was
changed
end;
end;

Jens




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.