Subject RE: [IBO] Setting the component descendant
Thanks Geoff,
what I actually wanted was redefining the Component defaults in design
time (when dropping a component on the form) and I did not realize, that
I can do it so simply. I must admit, that I was pretty stupid not to
find this solution :)

> -----Original Message-----
> From: Geoff Worboys (TeamIBO) [mailto:geoff@...]
> Sent: Monday, February 18, 2002 10:14 AM
> To: akahanek@...
> Subject: Re: [IBO] Setting the component descendant
> constructor TMyIBQuery.Create (AOwner: TComponent);
> begin
> inherited;
> // you dont need this
> // if csDesigning in ComponentState then begin
> SomeProperty := True;
> OtherProperty := False;
> // end;
> end;
> > This was to change the defaults of some properties and avoid
> > tweaking the component every time I drop it on the form. But there
> > is undesireable side effect: when I changed the property to other
> > value in the designer and after a while reopened the form in the
> > designer again, the constructor set the property back.
> To change defaults you dont need to check for csDesigning.
> In the class declaration you normally want the following...
> class TMyIBQuery = class(TIB_Query)
> published
> SomeProperty default True;
> OtherProperty default False;
> end;
> to stop the defaults from begin saved to the DFM unnecessarily.
> and then the constructor as you had it without the designer checks.
> (csDesigning is not in the ComponentState when the component is
> executed at runtime, so the default is never set).
> Note that overrides applied at designtime are applied in the "Loaded"
> method which is called after construction, so the constructor code
> above will not prevent you changing the properties at designtime.
> PS. Deriving your own component classes is a GREAT idea. I thoroughly
> recommend it for components that you use a lot - even if you dont have
> anything you want to override immediately.
> --
> Geoff Worboys - TeamIBO
> Telesis Computing