> Briefly, the component consists of a TGroupBox containing a TPanel. On the
> TPanel is a TDBEdit and a TBitBtn.
>
> The WM_SIZE message handler looks like this:
>
> procedure TGDBEdit.WmSize(var Message : TMessage);
> begin
> inherited;
> DBEdit.Width := Self.Width - 35;
> Self.Caption := IntToStr(DBEdit.Width); //added for debugging
> ClearButton.Left := Self.Width - 29;
> end;
>
> At design time in the IDE, everything works fine. When the component is
resized
> by the user, the button moves itself to remain at the right hand side, and
the
> DBEdit resizes itself.
>
> But at runtime, the DBEdit remains at its created or default size and does
not
> resize to fill the control, either when the app first starts up, or when
the
> component is resized. The caption which should show the new width of the
DBEdit
> does not change, but always displays the correct value at startup. The
button
> however will move correctly to the right hand side, always, when the
component
> is resized.
>
> Here is the source of the component to date:
>
You could also override the TControl.SetBounds virtual procedure. Every time
you change left, right, width, height of a control SetBounds is called to
perform the change. So if you replace your code with:
interface
...
procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override;
...
implementation
...
procedure TGDBEdit.SetBounds(ALeft, ATop, AWidth, AHeight: Integer);
begin
inherited SetBounds(ALeft, ATop, AWidth, AHeight);
DBEdit.Width := Self.Width - 35;
Self.Caption := IntToStr(DBEdit.Width); //added for debugging
ClearButton.Left := Self.Width - 29;
end;
It <should> work (no guarantees!).
David.
DB Solutions.
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"