Examples Delphi

Title: How to implement AfterShow, AfterCreate events
const
WM_AFTER_SHOW = WM_USER + 300; // custom message
WM_AFTER_CREATE = WM_USER + 301; // custom message
type
TForm1 = class(TForm)
// OnShow event
procedure FormShow(Sender: TObject);
// OnCreate event
procedure FormCreate(Sender: TObject);
private
procedure WmAfterShow(var Msg: TMessage); message WM_AFTER_SHOW;
procedure WmAfterCreate(var Msg: TMessage); message WM_AFTER_CREATE;
public
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.WmAfterShow(var Msg: TMessage);
begin
ShowMessage('WM_AFTER_SHOW received!');
end;
procedure TForm1.WmAfterCreate(var Msg: TMessage);
begin
ShowMessage('WM_AFTER_CREATE received!');
end;
procedure TForm1.FormShow(Sender: TObject);
begin
// Post the custom message WM_AFTER_SHOW to our form
PostMessage(Self.Handle, WM_AFTER_SHOW, 0, 0);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
// Post the custom message WM_AFTER_CREATE to our form
PostMessage(Self.Handle, WM_AFTER_CREATE, 0, 0);
end;