开发者

How can I place a Firefox toolbar button close to the address bar

开发者 https://www.devze.com 2023-03-29 21:57 出处:网络
I am developing a Firefox addon with a toolbar button. I would like this button to appear close to the browser\'s address bar and in the same line or row, either at its left or at its right. For insta

I am developing a Firefox addon with a toolbar button. I would like this button to appear close to the browser's address bar and in the same line or row, either at its left or at its right. For instance, like the page saver addon from Pearl Crescent.

But my code just manages to create an empty new row and places the toolbar button in it. A terrible waste of vertical space.

I am using the following overlay in my xul file:

<overlay id="browseye-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<toolbox id="navigator-toolbox">
    <toolbar id="my-toolbar"
        class="chrom开发者_JAVA技巧eclass-toolbar"
        toolbarname="my Toolbar"
        hidden="false"
        mode="full"
        defaultset="my-toolbar-button"
        persist="hidden collapsed">
        <toolbarbutton id="my-toolbar-button"
            tooltiptext="my Toolbar" 
            orient="horizontal"
            mousethrough="never"
            oncommand="my.onToolbarButtonCommand()">
        </toolbarbutton>
    </toolbar>
</toolbox>    
</overlay>

Could anybody please help me?


You need to add your button to the toolbarpalette tag without adding a new toolbar, see code example in https://developer.mozilla.org/en/XUL_School/Adding_Toolbars_and_Toolbar_Buttons#Adding_a_new_toolbar. Then the user will be able to position your button anywhere using "Customize toolbar" dialog.

0

精彩评论

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