开发者

MessageBox from secondary Form makes Main Form go to background/unfocus

I cannot get focus back to Main Form after closing Seco开发者_如何学JAVAnd Form.

When I do this: (From Main Form) "Form1Main":

..
Form2Output.Show;
..

From "Form2Output":

if (bNoWarnings = False) AND (Pos('-b',sExeOptions)=0)  then
begin
  if Application.MessageBox(PChar('Execute command line?'+ #13#10#13#10 + P.CommandLine), 'Execute?', MB_ICONQUESTION + MB_YESNO) = IDNO then Exit;
end;

It would appear Message Dialog 'steals' focus from main form (Form1Main goes to background when closing Form2Output). If I do not show the MessageDlg (conditions not met), the Main Form "refocuses" just fine when closing Form2Output. I am relatively new to Lazarus and any help would be great..


Put an Application.MainForm.BringToFront; in OnClose of the second form. This behaviour is not attributable to Object Pascal, it's a peculiarity of TApplication design of LCL.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜