delphi - 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?
解决方案
您是否尝试在 **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;
推荐阅读
- c# - 如何在 Uipath 中的 DataTable 上使用 LINQ 过滤器
- java - 从 api 返回成功为 true 或 false om Spring REST API
- python - 如何制作一个包含元素的列表作为python中输入的每一行
- html - 如何创建这个简单的浮动布局?
- python - 满足条件后返回文本文件中的指定行
- flutter - 如何将数据从扩展 DataTableSource 类传递到 StateFull 类
- javascript - 如何使用 asyncStorage 从本地存储中获取值并返回
- bash - 使用文件名中的日期格式删除早于 X 天的文件
- python - 如何计算每行具有动态条件的 Pandas df 元素(=countif)
- r - 自动将 y 轴文本和网格线对齐到 ggplot 的底部和顶部