2011-03-16 23 views
1

我可以製作BoxPane(例如垂直)BoxPane中的某個組件填充可用空間嗎?Apache Pivot:帶一個填充元素的BoxPane

例如,我希望ScrollPane採用標籤後留下的所有可用空間。 BXML:

<BoxPane orientation="vertical" styles="{fill:true}"> 
    <Label text="Triggers:" /> 
    <ScrollPane preferredWidth="80" preferredHeight="110" 
     horizontalScrollBarPolicy="fill" 
     verticalScrollBarPolicy="fill_to_capacity" 
     > 
     <ListView bxml:id="listTriggers" selectMode="single" 
      listData="['TRNIF_Trigger1'],['TRNIF_Trigger2'],['TRNIF_Trigger3']" 
     /> 
    </ScrollPane> 
</BoxPane> 

回答

4

它看起來像Pivot中的BoxPane設計只需要最小的需求空間。你必須使用TablePane。這對我來說看起來有些不幸,因爲在使用適合可用空間的大型前端時,BXML會爆炸。例如,在WinForms中,我可以對組件說:「以5px的距離粘貼到右邊框,並在需要時調整大小」。

然而,這裏是上面的問題/示例的BXML:

<TablePane styles="{padding:8, horizontalSpacing:6, verticalSpacing:6}"> 
    <columns> 
     <TablePane.Column width="1*" /> 
    </columns> 

    <TablePane.Row height="-1">      
     <Label text="Triggers:" /> 
    </TablePane.Row> 

    <TablePane.Row height="1*"> 
     <ScrollPane 
      horizontalScrollBarPolicy="fill" 
      verticalScrollBarPolicy="fill_to_capacity" 
      > 
      <ListView bxml:id="listTriggers" selectMode="single" 
       listData="['TRNIF_Trigger1'],['TRNIF_Trigger2'],['TRNIF_Trigger3']" 
      /> 
     </ScrollPane> 
    </TablePane.Row> 
</TablePane>