如何将本机窗口保持在顶部 [英] how to keep a nativewindow on top

查看:43
本文介绍了如何将本机窗口保持在顶部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在应用程序的主窗口之上保留一个我正在创建的 NativeWindow.

I need to keep a NativeWindow I am creating on top of the main window of the application.

目前我使用的是alwaysInFront = true,不限于应用程序中的窗口.我可以成功地同步最小化/恢复/移动/调整大小操作,因此在这些情况下顶部窗口的行为适当.即使使用此选项有一个缺点,即如果我使用 alt-tab 键切换到其他应用程序,窗口会位于其他应用程序的顶部.

Currently I am using alwaysInFront = true, which is not limited to the windows in the application. I can successfully synchronize the minimize/restore/move/resize actions, so the top window behaves appropriately in those cases. Even though using this option has the drawback that if I alt-tab to other application the window goes on top of the other application.

由于上述原因,我试图让它在不使用 alwaysInFront 的情况下工作.我曾尝试使用 orderInFrontOf 和 orderToFront,它可以将其固定到位,但是当我单击主窗口中的某个区域时,顶部的区域会隐藏起来,即空气使其成为顶部的区域.

Because of the above I am trying to get it to work without using the alwaysInFront. I have tried using orderInFrontOf and orderToFront, which gets it in place but when I click an area in the main window the top one becomes hidden i.e. air makes it the top one.

我尝试捕获激活/停用事件,但它仅在第一次单击时发生,因此在第二次单击时,顶部窗口再次隐藏.我还尝试在主窗口变为活动状态时激活顶部窗口,但这会导致主窗口失去焦点,我无法点击任何内容.

I have tried capturing activate/deactivate events but it only happens on the first click, so on the second click the top window becomes hidden again. I also tried making the top window active when the main one becomes active, but that causes the main one to loose focus and I can't click on anything.

附言.我这样做是为了改善我正在使用的 HTMLOverlay 的行为 - 请参阅 加载 Flash 内容时 Flex Air HTMLLoader 空白弹出窗口

Ps. I am doing this to improve the behavior of a HTMLOverlay I am using - see Flex Air HTMLLoader blank pop up window when flash content is loaded

推荐答案

我最终根据主窗口或顶部窗口是否处于活动状态来打开/关闭 alwaysInFront 选项,即如果没有活动的地方我将其关闭.这是我在问题中提到的内容的补充.

I ended up turning on/off the alwaysInFront option based on whether the main window or the top window were active i.e. if none where active I turned it off. This was additionally to what I mentioned in the question.

这样当用户切换到另一个应用程序时,窗口就不会位于其他应用程序之上.我仍然更喜欢不需要使用 alwaysInFront 选项的解决方案,或者更好的替代解决方案来解决我在上面链接的外部站点问题中的 flex 加载闪存问题.

That way when the user switches to another application, the window doesn't go on top of the other apps. I still would prefer a solution where I don't have to use the alwaysInFront option, or even better an alternate solution to the flex loading flash in external sites issue I linked to above.

附言.我将尝试与 HTMLOverlay 的所有者核实以提交补丁(这是一项改进,尽管它与打开叠加层时不会打开额外窗口的应用相关联).

Ps. I will try to check with the owner of the HTMLOverlay to submit a patch (its an improvement, although its tied to an app that doesn't open extra windows when opening the overlay).

更新:我已提交对 HTMLOverlay 的更改.

Update: I have committed the changes to the HTMLOverlay.

这篇关于如何将本机窗口保持在顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆