FF插件工具栏 - 添加的任何内容都位于工具栏的右侧

时间:2010-12-08 07:45:38

标签: firefox-addon

我遇到了我制作的firefox工具栏的问题。如果我拖动图标或将搜索框放到它上面,它们都会对齐工具栏的左侧,并将我的工具栏图标向右推。如果我移动图标,我拖动到我的图标右侧的栏上,当Firefox重新启动时,它们会移回到左侧。我不知道我做错了什么。

这是我的代码:

   <toolbox id="navigator-toolbox">

    <toolbar id="TutTB-Toolbar" toolbarname="FreeLayer Toolbar" accesskey="T"
             class="chromeclass-toolbar" context="toolbar-context-menu" 
             hidden="false" mode="icons" persist="hidden" customizable="true" observes="cmd_viewrstb" inherits="hidden" >


        <toolbaritem>
            <toolbarbutton id="Back-MainMenu" type="Plain" oncommand="gBrowser.webNavigation.goBack()"
                           tooltiptext="Back">
            </toolbarbutton>
            <toolbarbutton id="Foward-MainMenu" type="Plain" oncommand="gBrowser.webNavigation.goForward()"
                           tooltiptext="Forward">
            </toolbarbutton>
            <toolbarbutton id="Reload-MainMenu" type="Plain" oncommand="BrowserReloadSkipCache();"
                           tooltiptext="Reload">
            </toolbarbutton>
            <toolbarbutton id="Home-MainMenu" type="Plain" oncommand="window.BrowserHome()"
                           tooltiptext="Home">
            </toolbarbutton>                                                            




            <menulist id="TutTB-SearchTerms" editable="true" flex="1"
                      minwidth="100" width="450"
                      onkeypress="objTutorialToolbar.KeyHandler(event);">
                <menupopup id="TutTB-SearchTermsMenu" onpopupshowing="objTutorialToolbar.Populate()" />
            </menulist>


        <splitter id="TutTB-ResizeSplitter" state="open" collapse="none"
                  resizebefore="closest" resizeafter="farthest"
                  tooltiptext="Resize the Search Box">
            <vbox id="TutTB-ResizeBar" />
        </splitter>


            <toolbarbutton id="TutTB-Combined-Button" label="Search"
                           type="Plain" tooltiptext="Search"
                           oncommand="objTutorialToolbar.Search(event, 'web')">

            </toolbarbutton>

             <toolbarbutton id="Loc-MainMenu" type="menu-button"
               tooltiptext="Actual Location">
                 <menupopup>
                    <menuitem id="web-location" label="Actual Location"
                    class="menuitem-iconic" tooltiptext="Actual Location" />
                 </menupopup>
            </toolbarbutton>  
        </toolbaritem>

        <toolbarspring />


    </toolbar>
</toolbox>

2 个答案:

答案 0 :(得分:0)

嘿克里斯.. 我不确定你想做什么。 但请尝试使用工具栏的align属性。 对齐是一个通用属性,可用于对齐xul中的各种对象。  https://developer.mozilla.org/en/XUL/align

或者,您可以使用insertafter或insertbefore属性来指定您希望放置工具栏的确切位置。

答案 1 :(得分:0)

您的toolbaritem没有ID,这意味着工具栏自定义代码无法保持其位置。