javascript - How to place a Xul window as "Always On Top"? -
i found this file @ google code function:
function setalwaysontop() { var chktop = document.getelementbyid("itmalwaysontop"); var xulwin = window.queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsiwebnavigation).queryinterface(ci.nsidocshelltreeitem) .treeowner.queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsixulwindow); if(chktop.getattribute("checked") == "true") { xulwin.zlevel = xulwin.raisedz; } else { xulwin.zlevel = xulwin.normalz; } }
the parts of need just:
var xulwin = window.queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsiwebnavigation).queryinterface(ci.nsidocshelltreeitem) .treeowner.queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsixulwindow); xulwin.zlevel = xulwin.raisedz;
but i'm not finding where's ci defined. idea can be? or other idea of how set window on top? (that solution "just windows" don't fits me).
--update
i'm reading nsiwindowmediator, has methods handle window z order. it's saying methods should used c++, not javascript. means code should used xpcom components (i should xpcom component open window)? used confirm?
i'm still reading anyway.
--update
i've tried nsiwindowmediator (with xpcom component) nothing when set z level.
still way put window aways on top..
--attempt 'alwaysraised':
test.xul:
<?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window width="400" height="300" onload="open('top.xul','greenfoxchannelwindow','chrome, alwaysraised');" 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>
didn't worked.
--attempt 'zlevel':
test.xul:
<?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window width="400" height="300" onload="open('top.xul','greenfoxchannelwindow','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" zlevel="6" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <label value="on top"/> </window>
didn't worked. nither alwaysraised setted, or adding higher or lower zlevel test.xul (with top.xul zlevel="6")
found: open using opendialog, , 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>
Comments
Post a Comment