首页 > 解决方案 > Delphi FMX FormStyle StayOnTop only while app is active

问题描述

Delphi 10.4 FMX desktop project

I create a form and set its FormStyle to StayOnTop. The window works as expected, staying on top of other windows in the project.

But when the app goes into the background, this form stays on top of all other apps. How do get this window to go into the background like all the other windows in the project?

标签: delphifiremonkeydelphi-10.4-sydney

解决方案



您是否尝试在 **MainForm** 上进行 OnActivate 和 OnDeactivate ?:
procedure TForm1.FormActivate(Sender: TObject);
begin
  if Assigned(Form2) then
    Form2.FormStyle := TFormStyle.StayOnTop;
end;

procedure TForm1.FormDeactivate(Sender: TObject);
begin
  if Assigned(Form2) then
    Form2.FormStyle := TFormStyle.Normal;
end;

推荐阅读