[Lazarus] Components

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Jan 14 14:33:55 CET 2013


Antonio Fortuny <a.fortuny at sitasoftware.lu> hat am 14. Januar 2013 um 14:24
geschrieben:
> Hi All.
>
> I'm building new components. I've made my first one, installed it and
> used it. So far so good.
> I'm trying not to give to the component default sizes and I can(t figure
> out how this can be done. To be more precise, I inherit from a
> TCustomPanel to which I wold like to add some more properties and
> methods. I'd like also to give default sizes which are far from those of
> a TCustomPanel.
> I've used
> Height := 25;
> Width := 75;
> in the overridden creator and

Should work, except with AutoSize. SetInitialBounds does the same but with less
overhead.


> with GetControlClassDefaultSize do
> SetInitialBounds(0, 0, 75, 25);

Note: The "with" has no effect.
SetInitialBounds should work. For AutoSize you need more.


> without success. My new component works as expected anyway.
>
> Did I miss something ?

For AutoSize you can override

GetControlClassDefaultSize.

Mattias




More information about the Lazarus mailing list