开发者

docking panel in xul

how can I make docking pane开发者_StackOverflowl in xul. It should work like in firebug. I tried something like this:

myWindow = window.open("chrome://project/content/myWindow.xul", "someRandomName", "chrome");

and myWindow.xul is:

<?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 is my panel, and myPanel is id of vbox in myPanel.xul

When I open window like this, it looks quite like I wanted, but all buttons/other components don't work. For example if I have button in myPanel.xul:

<button id="myButton" label="button" onclick = "jsScriptFromOtherFile.someFunction()"/>

and if I click that button on myWindow, then someFunction isn't called. I don't know why, and how to make it working.


I guess your problem is that you expect all windows to share JavaScript code/state/scope, whatever you call it; 'jsScriptFromOtherFile' is not defined in any script loaded in 'myWindow.xul' or 'myPanel.xul', it's defined in the parent window that calls window.open.

Each 'window' (or tab, iframe, etc.) gets its own global object. To access variables from a different 'window' you first have to get a handle on that window. See Working with windows in chrome code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜