You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Joseph Paterson <jo...@gmail.com> on 2012/06/06 04:00:44 UTC

SplitPane within a BoxPane

Hello,

I'm trying to setup the general layout of my application, and ideally I
would like a menu at the top, something in the middle and a placeholder for
a status bar at the bottom. I'm using a Frame as it has built-in support
for the menu, and for the content I am using a BoxPane. The BoxPane will
contain a SplitPane followed by a Label for the status bar, but I can't get
the SplitPane to show up. If I have it on it's own (ie. not within the
BoxPane) it is fine, but it disappears when I have it in the BoxPane. My
BXML file looks like this:

<Frame xmlns="org.apache.pivot.wtk"
  title="My Title" styles="{showWindowControls:false}" maximized="true">

  <menuBar>
    *[...]*
  </menuBar>

  <BoxPane orientation="vertical" styles="{fill:true}">
    <SplitPane orientation="vertical" splitRatio="0.8">
      <left>
        <Border/>
      </left>
      <right>
        <Border/>
      </right>
    </SplitPane>
    <Label text="Status Bar Text"/>
  </BoxPane>
<Frame>

Am I missing something?

Many thanks,

Joseph.

Re: SplitPane within a BoxPane

Posted by Joseph Paterson <jo...@gmail.com>.
That works perfectly - thanks for the explanation & suggestion Roger!

On Wed, Jun 6, 2012 at 1:22 PM, Roger L. Whitcomb <Roger.Whitcomb@actian.com
> wrote:

> Try using a TablePane instead of the BoxPane.  The reason you are seeing
> this is the following:****
>
> **·         **BoxPane, vertical with fill=true will lay out its children
> from top to bottom and size them horizontally to fill the space, but only
> take as much room as required vertically to fit its children’s size(s).***
> *
>
> **·         **Since the SplitPane doesn’t have a native size (it will
> stretch itself horizontally to fill the space, but has no vertical size
> without something to give it a size) it will end up with a 0 height.****
>
> ** **
>
> So, you could, instead of a BoxPane, use a TablePane with two rows (sizes
> “1*” and “-1”) and one column (size “1*”).  This option will leave room for
> your status row (as the bottom row of the TablePane) and take up the rest
> of the space with the other row, which will give a size to the SplitPane.*
> ***
>
> ** **
>
> The code would look something like this:****
>
> <Frame …>****
>
>   <menuBar>****
>
> …****
>
>   </menuBar>****
>
>   <TablePane>****
>
>     <columns>****
>
>       <TablePane.Column width=”1*”/>****
>
>     </columns>****
>
>     <rows>****
>
>       <TablePane.Row height=”1*”>****
>
>         <SplitPane …>****
>
> …****
>
>         </SplitPane>****
>
>       </TablePane.Row>****
>
>       <TablePane.Row height=”-1”>****
>
>         <Label text=”Status Bar Text”/>****
>
>       </TablePane.Row>****
>
>     </rows>****
>
>   </TablePane>****
>
> </Frame>****
>
>   ****
>
> Try that and see how it goes.****
>
>     ****
>
> *~Roger Whitcomb*
>
> ** **
>
> *From:* Joseph Paterson [mailto:joseph.paterson@gmail.com]
> *Sent:* Tuesday, June 05, 2012 7:01 PM
> *To:* user@pivot.apache.org
> *Subject:* SplitPane within a BoxPane****
>
> ** **
>
> Hello,****
>
> ** **
>
> I'm trying to setup the general layout of my application, and ideally I
> would like a menu at the top, something in the middle and a placeholder for
> a status bar at the bottom. I'm using a Frame as it has built-in support
> for the menu, and for the content I am using a BoxPane. The BoxPane will
> contain a SplitPane followed by a Label for the status bar, but I can't get
> the SplitPane to show up. If I have it on it's own (ie. not within the
> BoxPane) it is fine, but it disappears when I have it in the BoxPane. My
> BXML file looks like this:****
>
> ** **
>
> <Frame xmlns="org.apache.pivot.wtk"****
>
>   title="My Title" styles="{showWindowControls:false}" maximized="true">**
> **
>
> ** **
>
>   <menuBar>****
>
>     *[...]*****
>
>   </menuBar>****
>
> ** **
>
>   <BoxPane orientation="vertical" styles="{fill:true}">****
>
>     <SplitPane orientation="vertical" splitRatio="0.8">****
>
>       <left>****
>
>         <Border/>****
>
>       </left>****
>
>       <right>****
>
>         <Border/>****
>
>       </right>****
>
>     </SplitPane>****
>
>     <Label text="Status Bar Text"/>****
>
>   </BoxPane>****
>
> <Frame>****
>
> ** **
>
> Am I missing something?****
>
> ** **
>
> Many thanks,****
>
> ** **
>
> Joseph.****
>

RE: SplitPane within a BoxPane

Posted by "Roger L. Whitcomb" <Ro...@actian.com>.
Try using a TablePane instead of the BoxPane.  The reason you are seeing this is the following:

·         BoxPane, vertical with fill=true will lay out its children from top to bottom and size them horizontally to fill the space, but only take as much room as required vertically to fit its children’s size(s).

·         Since the SplitPane doesn’t have a native size (it will stretch itself horizontally to fill the space, but has no vertical size without something to give it a size) it will end up with a 0 height.

 

So, you could, instead of a BoxPane, use a TablePane with two rows (sizes “1*” and “-1”) and one column (size “1*”).  This option will leave room for your status row (as the bottom row of the TablePane) and take up the rest of the space with the other row, which will give a size to the SplitPane.

 

The code would look something like this:

<Frame …>

  <menuBar>

…

  </menuBar>

  <TablePane>

    <columns>

      <TablePane.Column width=”1*”/>

    </columns>

    <rows>

      <TablePane.Row height=”1*”>

        <SplitPane …>

…

        </SplitPane>

      </TablePane.Row>

      <TablePane.Row height=”-1”>

        <Label text=”Status Bar Text”/>

      </TablePane.Row>

    </rows>

  </TablePane>

</Frame>

  

Try that and see how it goes.

    

~Roger Whitcomb

 

From: Joseph Paterson [mailto:joseph.paterson@gmail.com] 
Sent: Tuesday, June 05, 2012 7:01 PM
To: user@pivot.apache.org
Subject: SplitPane within a BoxPane

 

Hello,

 

I'm trying to setup the general layout of my application, and ideally I would like a menu at the top, something in the middle and a placeholder for a status bar at the bottom. I'm using a Frame as it has built-in support for the menu, and for the content I am using a BoxPane. The BoxPane will contain a SplitPane followed by a Label for the status bar, but I can't get the SplitPane to show up. If I have it on it's own (ie. not within the BoxPane) it is fine, but it disappears when I have it in the BoxPane. My BXML file looks like this:

 

<Frame xmlns="org.apache.pivot.wtk"

  title="My Title" styles="{showWindowControls:false}" maximized="true">

 

  <menuBar>

    [...]

  </menuBar>

 

  <BoxPane orientation="vertical" styles="{fill:true}">

    <SplitPane orientation="vertical" splitRatio="0.8">

      <left>

        <Border/>

      </left>

      <right>

        <Border/>

      </right>

    </SplitPane>

    <Label text="Status Bar Text"/>

  </BoxPane>

<Frame>

 

Am I missing something?

 

Many thanks,

 

Joseph.