Patrick,

> I have a component derived from a Groupbox that displays a button
>   [...]
> How do I detect when my component has changed in width given that it
> inherits a Width property definition from TControl that can't be
> overridden
> ?

write a handler for the WMSize message.   (example below)


-ns




unit ZBox;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls,buttons;

type
  TZBox = class(TGroupBox)
  private
    { Private declarations }
    procedure WMSize(var Message: TMessage); message WM_SIZE;
  protected
    { Protected declarations }
    FButton:TBitBtn;
  public
    { Public declarations }
    constructor Create(AOwner: TComponent); override;
  published
    { Published declarations }
  end;

procedure Register;

implementation

constructor TZBox.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FButton:=TBitBtn.Create(AOwner);
  FButton.Parent:=self;
end;

procedure TZBox.WMSize(var Message: TMessage);
begin
  inherited;
  FButton.left:=width-FButton.width-5;
  FButton.top :=height - FButton.height -5;
end;

procedure Register;
begin
  RegisterComponents('Samples', [TZBox]);
end;

end.



---------------------------------------------------------------------------
    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"

Reply via email to