2010-11-05 40 views
0

如何在XUL中製作這樣的佈局?具有跨多列的元素的XUL網格

-------------------------------------------- 
elem11 | elem12 | elem13     | 
-------------------------------------------- 
elem21 | elem22 | elem23 | elem24 | elem25 | 
-------------------------------------------- 

<grid>似乎並沒有讓一個元素跨越多列,除非我失去了一些東西。

編輯:XUL

<groupbox flex="1"> 
    <caption label="&options.general.keyBindings;" /> 
    <vbox flex="1"> 
     <hbox flex="1" align="center"> 
      <checkbox id="nextpleaseAllowNumberShortcuts" oncommand="nextplease.enableDisableNumberShortcutModifierMenu();"/> 
      <menulist id="nextpleaseNumberShortcutModifier" prefstring="nextplease.numbermodifier" style="margin-right: 0"> 
       <menupopup onpopuphiding="nextplease.keyBindingsChanged = true;"/> 
      </menulist> 
      <label id="nextpleaseAllowNumberShortcuts1"/> 
     </hbox> 
     <separator class="thin"/> 
     <grid> 
      <columns> 
       <column/> 
       <column/> 
       <column/> 
       <column/> 
       <column/> 
       <column/> 
      </columns> 

      <rows> 
       <row align="center"> 
        <label value="&options.general.nextKey;" /> 
        <menulist id="nextpleaseNextModifier" prefstring="nextplease.modifier"> 
         <menupopup onpopuphiding="nextplease.onModifierMenuChange('nextkey', 'nextkeymenu', 'nextpleaseModifier');"/> 
        </menulist> 
        <label value="&options.general.enterKey;" /> 
        <textbox id="nextkey" type="text" size="1" maxlength="1" 
         onchange="return nextplease.onKeyChange('nextkey', 'nextkeymenu', 'nextpleaseModifier');" /> 
        <label value="&options.general.or;" /> 
        <menulist id="nextkeymenu"> 
         <menupopup onpopuphiding="return nextplease.onKeyMenuChange('nextkey', 'nextkeymenu', 'nextpleaseModifier');"/> 
        </menulist> 
       </row> 
       <row align="center"> 
        <label value="&options.general.prevKey;" /> 
        <menulist id="nextpleasePrevModifier" prefstring="nextplease.modifier"> 
         <menupopup onpopuphiding="nextplease.onModifierMenuChange('prevkey', 'prevkeymenu', 'nextpleasePrevModifier');"/> 
        </menulist> 
        <label value="&options.general.enterKey;" /> 
        <textbox id="prevkey" type="text" size="1" maxlength="1" 
         onchange="return nextplease.onKeyChange('prevkey', 'prevkeymenu', 'nextpleasePrevModifier');" /> 
        <label value="&options.general.or;" /> 
        <menulist id="prevkeymenu"> 
         <menupopup onpopuphiding="return nextplease.onKeyMenuChange('prevkey', 'prevkeymenu', 'nextpleasePrevModifier');"/> 
        </menulist> 
       </row> 
       <row align="center"> 
        <label value="&options.general.firstKey;" /> 
        <menulist id="nextpleaseFirstModifier" prefstring="nextplease.modifier"> 
         <menupopup onpopuphiding="nextplease.onModifierMenuChange('firstkey', 'firstkeymenu', 'nextpleaseFirstModifier');"/> 
        </menulist> 
        <label value="&options.general.enterKey;" /> 
        <textbox id="firstkey" type="text" size="1" maxlength="1" 
         onchange="return nextplease.onKeyChange('firstkey', 'firstkeymenu', 'nextpleaseFirstModifier');" /> 
        <label value="&options.general.or;" /> 
        <menulist id="firstkeymenu"> 
         <menupopup onpopuphiding="return nextplease.onKeyMenuChange('firstkey', 'firstkeymenu', 'nextpleaseFirstModifier');"/> 
        </menulist> 
       </row> 
       <row align="center"> 
        <label value="&options.general.lastKey;" /> 
        <menulist id="nextpleaseLastModifier" prefstring="nextplease.modifier"> 
         <menupopup onpopuphiding="nextplease.onModifierMenuChange('lastkey', 'lastkeymenu', 'nextpleaseLastModifier');"/> 
        </menulist> 
        <label value="&options.general.enterKey;" /> 
        <textbox id="lastkey" type="text" size="1" maxlength="1" 
         onchange="return nextplease.onKeyChange('lastkey', 'lastkeymenu', 'nextpleaseLastModifier');" /> 
        <label value="&options.general.or;" /> 
        <menulist id="lastkeymenu"> 
         <menupopup onpopuphiding="return nextplease.onKeyMenuChange('lastkey', 'lastkeymenu', 'nextpleaseLastModifier');"/> 
        </menulist> 
       </row> 
      </rows> 
     </grid> 
    </vbox> 
</groupbox> 

我想什麼是轉<hbox>nextpleaseAllowNumberShortcuts到它下面的網格的一行。帶標籤的複選框位於第一列,第二列的菜單(其他行的菜單相同),標籤跨越其餘列。

+0

你能發佈你的xul代碼嗎?而且,如果有一些,XBL也是如此。 – 2010-11-05 13:29:03

回答

2

你必須通過製作三列網格並在第三列第二行放置一個hbox來僞造這個。你是正確的,你不能跨越多個列。

+0

不幸的是,如果我有3行而不是2,這將失敗。簡化太多了。 – 2010-11-05 15:37:36

+0

使用單個網格來完成此操作的唯一方法是,如果您想要一個字段真正「跨度」,則使用最少數量的列 - 在您的情況下爲三個。 – pc1oad1etter 2010-11-05 19:08:55

+0

然後,在所有其他行中,您需要在最後一列包含以及所有其他'列'。這可能需要對佈局進行一些試驗以使其看起來像你想要的樣子。 – pc1oad1etter 2010-11-05 19:10:04