I am having a toolbar-button with type "menu-button". 开发者_Python百科Can I have two toolbar-buttons inside this one?
Since you would like to have a button inside a menu-button, here you go. But, this is not a pretty good UI.
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<window id="main-window">
<toolbox id="navigator-toolbox">
<toolbar id="xulschoolhello-toolbar" toolbarname="xulschoolhello.toolbarName.label;"
customizable="true" mode="icons" context="toolbar-context-menu"
defaultset="xulschoolhello-hello-world-button"
insertbefore="PersonalToolbar" />
<hbox>
<row> <button flex="1" type="menu" label="Menu">
<menupopup>
<menuitem label="Option 1" oncommand="setText('menu-text','Option 1');" />
<menuitem label="Option 2" oncommand="setText('menu-text','Option 2');" />
<menuitem label="Option 3" oncommand="setText('menu-text','Option 3');" />
<menuitem label="Option 4" oncommand="setText('menu-text','Option 4');" />
</menupopup>
</button> </row>
<row> <button flex="1" type="menu-button" label="MenuButton" oncommand="alert('Button was pressed!');">
<menupopup>
<menuitem label="Option A" oncommand="setText('menu-text','Option A');" />
<menuitem label="Option B" oncommand="setText('menu-text','Option B');" />
<menuitem label="Option C" oncommand="setText('menu-text','Option C');" />
<menuitem label="Option D" oncommand="setText('menu-text','Option D');" />
</menupopup>
</button></row>
</hbox>
<hbox pack="center">
<description id="menu-text" value="Testing" />
</hbox>
</toolbox>
</window>
</window>
精彩评论