How to place a Xul window as “Always On Top”?

倖福魔咒の 提交于 2019-12-06 04:36:24

Found: just open it using openDialog, and it will be always on top.

Ex:

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>

<window width="400" height="300"
    onload="openDialog('top.xul','TopWindow','chrome');"
    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

    <label value="MAIN WINDOW"/>

</window>

top.xul:

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>

<window width="400" height="300"
    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

    <label value="ON TOP" />

</window>

If you always want the window to be on top, then the easiest way is to use the alwaysraised chrome flag when opening the window.

If you don't get to open the window yourself, the second easiest way is to use <window zlevel="6"> in your XUL. You can even persist the zlevel; SeaMonkey's Help window does this, using a context menu option to toggle the zLevel.

By the way, Ci is a common abbreviation for Components.interfaces since writing (e.g.) Components.interfaces.nsIXULWindow.rasiedZ is difficult to do on 80-character lines.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!