开发者

How to create pop up form at start of program in delphi?

Hi all,

I want to disp开发者_运维技巧lay that option form above the Main Form when application will run. So How can I display Option form with Main form in background at start?

Thanks for help.


Can use OnActivate. Have to wrap it in some code to prevent it from firing when other application forms close and the main one gets activated again however.

procedure TForm1.FormActivate(Sender: TObject);
Const
{$J+}
  SettingsShown : Boolean = false;
{$J-}
begin
  if SettingsShown = false then
  begin
    Form2.ShowModal;
    SettingsShown := True;
  end;
end; 


instead of using OptionForm.ShowModal in OnCreate or OnShow create a custom message like Const AM_ShowOptionForm = WM_APP +1 and Post a message back to your main form.

Add a message handler on your main form such as

Procedure RecieveOptionFormMessage(var Msg:TMessage); Message AM_ShowOptionForm
begin
    OptionForm.ShowModal;
end;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜