[Lazarus] constructor Create How is it work?

FreeMan freeman35 at delphiturkiye.com
Wed Mar 5 13:52:40 CET 2014


Yes, One moretime, all woit goes to Mattias, :)
I'm still not useto lazarus style code structure. Ancestor component, 
trigger when finish initialization self, this mean (for me) I have to 
sparate my code.
in
  constructor TExLookUp.Create;
  FGrid := TRxDBGrid.Create(Self);
   FGrid.Visible    := False;
   FGrid.DataSource := FListField.DataSource;
.....
set  FGrid.xxx properies, not get parent's (TExLookUp) properties. 
TExLookUp.Left, TExLookUp.Top etc

procedure TExLookUp.Loaded;
begin
   inherited Loaded;
// Now TExLookUp.xx is ready for getting properties
   FGrid.Left  := Self.Left;
   FGrid.Top   := Self.BoundsRect.Bottom-2;
   FGrid.Width := Self.BoundsRect.Right - Self.BoundsRect.Left + 
Self.ButtonWidth;
   FGrid.Parent := Self.Parent;
end;

I did, I tested, and thats okey now.

Thank you,

05-03-2014 14:12 tarihinde, Mattias Gaertner yazdı:
> [...]
> I have to wait, when
> self(TExLookUp) has created, and load self's properties loaded from,
> Override method Loaded.
>
>
> Mattias




More information about the Lazarus mailing list