home *** CD-ROM | disk | FTP | other *** search
- unit Subcomp;
-
- { Program copyright (c) 1995 by Charles Calvert }
- { Project Name: SUBCOMP }
-
- { Create a TPanel descendant with objects on it. Shows how to
- use wm_Create messages to access methods not available to
- you in the constructor.
- }
-
- interface
-
- uses
- Classes, Controls, StdCtrls,
- ExtCtrls, Messages;
-
- type
- TMyPanel = class(TPanel)
- private
- FMyEdit: TEdit;
- protected
- procedure wmCreate(var M: TMessage); message wm_Create;
- public
- constructor Create(AOwner: TComponent); override;
-
- end;
-
- procedure Register;
-
- implementation
-
- procedure Register;
- begin
- RegisterComponents('Unleashed', [TMyPanel]);
- end;
-
- constructor TMyPanel.Create(AOwner: TComponent);
- begin
- inherited Create(AOwner);
- Visible := True;
- Width := 100;
- Height := 100;
- FMyEdit := TEdit.Create(Self);
- FMyEdit.Parent := Self;
- FMyEdit.Left := 5;
- FMyEdit.Top := 5;
- FMyEdit.Height := 25;
- end;
-
- { You can't access ClientWidth in the Create method,
- so respond to wm_Create message }
- procedure TMyPanel.wmCreate(var M: TMessage);
- begin
- inherited;
- FMyEdit.Width := ClientWidth - 10;
- end;
-
- end.
-
-