FreeMan schrieb:
ExLookUp1:=TExLookUp.Create(Form1); This is for manual creating, I'm
talk about, I'm designing in IDE, 1-2 TExLookUp on form, and run my
application, TExLookUp is class(TCustomEditButton) so Edit and button is
shown on where I put on form, in designtime IDE.
constructor TExLookUp.Create(AOwner: TComponent);
begin inherited Create(AOwner);
Self.OnChange := @EditChange;
set more Self properties here!
FGrid := TRxDBGrid.Create(Self);
FGrid.Parent := Self.Parent;
FGrid.Left := Self.Left;
FGrid.Top := Self.Heigh + 10;
FGrid.Width := 150;
FGrid.visible := False;
...
Please remember that you are in the TExLooUp constructor. Finish
initialization of this component, before assigning Self.whatever to the
FGrid.
When the TExtLookUp is initialized from the form resource, you have to
wait until this has been done. In this case I'd move the FGrid related
part into the TExLookUp.OnCreate handler, which AFAIK is called *after*
the TExtLookUp has been created and fully initialized.
Or put the code into ExtLookUp.SetParent, as Mattias suggests. But this
solution depends on the order, how the TExtLookUp properties are
initialized from the form resource. When Parent is set before Left,
Height etc., this solution doesn't work either.
DoDi
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus