D,
Try TControl(DBEdit).Width := 123 as.....
procedure TControl.SetWidth(Value: Integer);
begin
SetBounds(FLeft, FTop, Value, FHeight);
Include(FScalingFlags, sfWidth);
end;
This achieves ensuring that the control gets correctly resized with
SetBounds et al......
------------------------------------------------------------------------
--Donovan [[EMAIL PROTECTED]]
Donovan J. Edye [www.edye.wattle.id.au]
Namadgi Systems, Delphi Developer [www.namsys.com.au]
Voice: +61 2 6285-3460 Fax: +61 2 6285-3459
TVisualBasic = Class(None);
Heard just before the 'Big Bang': "...Uh Oh...."
------------------------------------------------------------------------
GXExplorer [http://www.gxexplorer.org] Freeware Windows Explorer
replacement. Also includes freeware delphi windows explorer components.
------------------------------------------------------------------------
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of David Brennan
Sent: Friday, 20 October 2000 08:47
To: Multiple recipients of list delphi
Subject: Re: [DUG]: Redrawing Components
> 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"
---------------------------------------------------------------------------
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"