[Project_owners] Opening "Customize Toolbar" window
Brian King
brian at mozdev.org
Fri Sep 1 19:48:45 EDT 2006
Bartosz Piec wrote:
> Hello,
>
> How to open a "Customize Toolbar" window from my extension's preference
> window? I've tried to execute the code from Firefox's browser.js file:
>
> function BrowserCustomizeToolbar()
> {
> // Disable the toolbar context menu items
> var menubar = document.getElementById("main-menubar");
> for (var i = 0; i < menubar.childNodes.length; ++i)
> menubar.childNodes[i].setAttribute("disabled", true);
>
> var cmd = document.getElementById("cmd_CustomizeToolbars");
> cmd.setAttribute("disabled", "true");
>
> window.openDialog("chrome://global/content/customizeToolbar.xul",
> "CustomizeToolbar",
> "chrome,all,dependent",
> document.getElementById("navigator-toolbox"));
> }
>
> but the menubar variable is null.
Sounds like the wrong scope, i.e. Try using the window manager to get
the browser window (lets call it win), then replace all occurrences of
document.getElementById with win.document.getElementById.
However, the Customize dialog may not function properly if not opened by
the main browser window.
--
Brian King
www.mozdev.org - free project hosting for the Mozilla community
More information about the Project_owners
mailing list