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;
加载中,请稍侯......
精彩评论