Delphi 5 pro.
I often want to autoamtically run some code directly after the form has
shown. If this is done in the OnShow event it gets done while the form is
still invisible (not good if the code takes a little while to run.)
Currently, I use a Timer with its interval property set to about 200 and
enabled set to false. In the OnShow event I set Timer.Enabled := True and
the first statement in the OnTimer event is Timer.Enabled := False so the
event only runs once.
BUT knowing delphi, there is probably a much nicer way to do this. Any ideas
?
--
Cheers,
Paul
PAC Software Solutions
www.pacsoftware.com.au
pa...@pacsoftware.com.au
Sure,
Post a message to yourself.
Dave
could you maybe give me an example of how to do this ?
--
Cheers,
Paul
PAC Software Solutions
www.pacsoftware.com.au
pa...@pacsoftware.com.au
"Dave" <dgsom...@bigpond.com> wrote in message news:3d1be81e_1@dnews...
> > Post a message to yourself.
Hi,
Use this code to post a custom message to yourself.
const
WM_AFTER_SHOW = WM_USER + 300; // custom message
type
TForm1 = class(TForm)
procedure FormShow(Sender: TObject);
private
procedure WmAfterShow(Var Msg: TMessage); message WM_AFTER_SHOW;
public
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.WmAfterShow(var Msg: TMessage);
begin
ShowMessage('WM_AFTER_SHOW received!');
end;
procedure TForm1.FormShow(Sender: TObject);
begin
// Post the custom message to our form
PostMessage(Self.handle, WM_AFTER_SHOW, 0, 0);
end;
HTH
tom
--
Cheers,
Paul
PAC Software Solutions
www.pacsoftware.com.au
pa...@pacsoftware.com.au
"Thomas Stutz" <t...@swissdelphicenter.ch> wrote in message
news:3d1bede7$1_2@dnews...
Delphi 5 pro.
I often want to autoamtically run some code directly after the form has
shown. If this is done in the OnShow event it gets done while the form is
still invisible (not good if the code takes a little while to run.)
Currently, I use a Timer with its interval property set to about 200 and
enabled set to false. In the OnShow event I set Timer.Enabled := True and
the first statement in the OnTimer event is Timer.Enabled := False so the
event only runs once.
BUT knowing delphi, there is probably a much nicer way to do this. Any ideas
?
--
> > Post a message to yourself.
Hi,
Sure,
Post a message to yourself.
Dave
--
Cheers,
Paul
PAC Software Solutions
www.pacsoftware.com.au
pa...@pacsoftware.com.au
"Thomas Stutz" <t...@swissdelphicenter.ch> wrote in message
news:3d1bede7$1_2@dnews...
could you maybe give me an example of how to do this ?
--
Cheers,
Paul
PAC Software Solutions
www.pacsoftware.com.au
pa...@pacsoftware.com.au
"Dave" <dgsom...@bigpond.com> wrote in message news:3d1be81e_1@dnews...
>