pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Volkert <tvolk...@gmail.com>
Subject Re: Layout managers
Date Mon, 14 Sep 2009 12:03:14 GMT
> How maximize button on full window.
>

If you want the button to take up the whole space of the window, you could
just set it as the content of the window:

 <Window title="Menus" maximized="true" xmlns:wtkx="
http://pivot.apache.org/wtkx"
       xmlns:content="org.apache.pivot.wtk.content"
xmlns="org.apache.pivot.wtk">
   <content>
       <PushButton buttonData="Press me"/>
   </content>
</Window>

how to stretch the button vertically?
>

I'd use a horizontal BoxPane with the "fill" style set to true:

 <Window title="Menus" maximized="true" xmlns:wtkx="
http://pivot.apache.org/wtkx"
       xmlns:content="org.apache.pivot.wtk.content"
xmlns="org.apache.pivot.wtk">
   <content>
       <BoxPane orientation="horizontal" styles="{fill:true,
backgroundColor: '#FFFF00'}">
           <PushButton buttonData="Press me"/>
       </BoxPane>
   </content>
</Window>


> TablePane: how to stretch the row 100% with table
>

The components in the row will be as wide as their column.  To get a column
to take up the available space in the table pane, use a relative width.

For example, this table pane's sole column has a relative width of 1 (1*),
meaning it'll take up all the available space of the table pane.  As such,
the button takes up all of that width.

<Window title="Menus" maximized="true" xmlns:wtkx="
http://pivot.apache.org/wtkx"
       xmlns:content="org.apache.pivot.wtk.content"
xmlns="org.apache.pivot.wtk">
   <content>
       <TablePane styles="{backgroundColor: '#FFFF00'}">
           <columns>
               <TablePane.Column width="1*"/>
           </columns>
           <rows>
               <TablePane.Row height="-1">
                   <PushButton buttonData="Press me"/>
               </TablePane.Row>
           </rows>
       </TablePane>
   </content>
</Window>

But in the following example, we change the column's width to be default
(-1), meaning that it's only as wide as it needs to be.  As such, the column
is just wide enough to give the button its preferred width.

<Window title="Menus" maximized="true" xmlns:wtkx="
http://pivot.apache.org/wtkx"
       xmlns:content="org.apache.pivot.wtk.content"
xmlns="org.apache.pivot.wtk">
   <content>
       <TablePane styles="{backgroundColor: '#FFFF00'}">
           <columns>
               <TablePane.Column width="-1"/>
           </columns>
           <rows>
               <TablePane.Row height="-1">
                   <PushButton buttonData="Press me"/>
               </TablePane.Row>
           </rows>
       </TablePane>
   </content>
</Window>

I'd check out the not-yet-public table pane tutorial at
http://incubator.apache.org/pivot/1.3/tutorials/table_panes.html for more
info.

Hope that helps,
-T

Mime
View raw message