 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Ignacio Vazquez Guest
|
Posted: Wed Oct 08, 2003 4:41 am Post subject: Re: Afterclonsturction method or ? |
|
|
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
|
Posted: Thu Oct 09, 2003 12:01 pm Post subject: Re: Afterclonsturction method or ? |
|
|
| 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
|
Posted: Tue Oct 14, 2003 9:23 pm Post subject: Re: Afterclonsturction method or ? |
|
|
| 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 |
|
 |
|
|
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
|
|