如何在 xul 中制作对接面板。它应该像在萤火虫中一样工作。我试过这样的事情:
myWindow = window.open("chrome://project/content/myWindow.xul", "someRandomName", "chrome");
myWindow.xul 是:
<?xml version="1.0" encoding="utd-8"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xul-overlay href="chrome://project/content/myPanel.xul"?>
<window id="dockedPanel" title="my super extension" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml">
<hbox flex="1">
<vbox id="myPanel"/>
</hbox>
</window>
myPanel.xul 是我的面板,myPanel 是 myPanel.xul 中 vbox 的 id
当我像这样打开窗口时,它看起来很像我想要的,但是所有按钮/其他组件都不起作用。例如,如果我在 myPanel.xul 中有按钮:
<button id="myButton" label="button" onclick = "jsScriptFromOtherFile.someFunction()"/>
如果我单击 myWindow 上的该按钮,则不会调用 someFunction。我不知道为什么,以及如何使它工作。