You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Daniel Ziltener <zi...@lyrion.ch> on 2011/03/05 16:42:20 UTC

A split pane inside any other pane seems not to work?

I'm trying to put a SplitPane inside a BoxPane, but this doesn't work. I
tried literally everything, from wrapping it inside another container before
putting it inside the BoxPane over manually setting the size but nothing
works. It seems like it gets a height of 0, even when manually setting it to
another value. It only seems to work when put in the Window tag as the only
component.
What am I doing wrong?

Re: A split pane inside any other pane seems not to work?

Posted by Greg Brown <gk...@verizon.net>.
> A horizontal box pane will optionally size its children to fill the vertical space, but it doesn't impose any constraints in the horizontal direction. Vertical box panes behave similarly.
> 
> "optionally" meaning you have to set the "fill" style to true for this behavior.  Otherwise, BoxPanes pass along no width/height information at all to their children, I think. I've been bit by that a couple times.

Correct - if fill is false (the default), BoxPane will give each child its preferred size. Otherwise, it will give each child its constrained preferred height or width, depending on its orientation.


Re: A split pane inside any other pane seems not to work?

Posted by Bill van Melle <bi...@gmail.com>.
>
> A horizontal box pane will optionally size its children to fill the
> vertical space, but it doesn't impose any constraints in the horizontal
> direction. Vertical box panes behave similarly.
>

"optionally" meaning you have to set the "fill" style to true for this
behavior.  Otherwise, BoxPanes pass along no width/height information at all
to their children, I think. I've been bit by that a couple times.

Re: A split pane inside any other pane seems not to work?

Posted by Greg Brown <gk...@verizon.net>.
No, BoxPane just isn't designed to work that way. BoxPane lays components out in a horizontal or vertical row. A horizontal box pane will optionally size its children to fill the vertical space, but it doesn't impose any constraints in the horizontal direction. Vertical box panes behave similarly.

On Mar 7, 2011, at 11:12 AM, Daniel Ziltener wrote:

> Ok, I'll try that. Is that a bug in BoxPane that this doesn't work correctly?
> 
> 2011/3/7 Greg Brown <gk...@verizon.net>
> Correct. You probably don't want to put the SplitPane in a hierarchy where you have a BoxPane as an ancestor. I'd recommend using a TablePane instead of a BoxPane in this case.
> 
> On Mar 7, 2011, at 10:32 AM, Daniel Ziltener wrote:
> 
>> Actually, I can wrap the SplitPane with whatever I want, as long as there is a BoxPane involved in layouting it doesn't work.
>> Right now I have the following hierarchy up to the problematic SplitPane:
>> Window -> Border -> FlowPane -> BoxPane -> StackPane -> SplitPane. And the SplitPane apparently gets a height of 0 as long as neither the SplitPane nor any of the contained components get an explicit preferredWidth.
>> 
>> 2011/3/7 Greg Brown <gk...@verizon.net>
>> > Apparently such a container is non-existent and preferredWidth and preferredHeight has to be used.
>> 
>> What makes you think that? There are plenty of containers that you could use for this:
>> 
>> Border
>> GridPane
>> StackPane
>> TablePane
>> TabPane
>> Window
>> 
>> You have to set an explicit preferred size *somewhere*, but that is generally done at the top level on Window, either via the "maximized" flag or via the pref. size properties.
>> 
>> > I think I'll just have to listen to width and height changes and then set the preferred sizes manually.
>> 
>> You can do that, but as I said, it's really not the "right" way to do it.
>> 
>> 
> 
> 


Re: A split pane inside any other pane seems not to work?

Posted by Daniel Ziltener <zi...@lyrion.ch>.
Ok, I'll try that. Is that a bug in BoxPane that this doesn't work
correctly?

2011/3/7 Greg Brown <gk...@verizon.net>

> Correct. You probably don't want to put the SplitPane in a hierarchy where
> you have a BoxPane as an ancestor. I'd recommend using a TablePane instead
> of a BoxPane in this case.
>
> On Mar 7, 2011, at 10:32 AM, Daniel Ziltener wrote:
>
> Actually, I can wrap the SplitPane with whatever I want, as long as there
> is a BoxPane involved in layouting it doesn't work.
> Right now I have the following hierarchy up to the problematic SplitPane:
> Window -> Border -> FlowPane -> BoxPane -> StackPane -> SplitPane. And the
> SplitPane apparently gets a height of 0 as long as neither the SplitPane nor
> any of the contained components get an explicit preferredWidth.
>
> 2011/3/7 Greg Brown <gk...@verizon.net>
>
>> > Apparently such a container is non-existent and preferredWidth and
>> preferredHeight has to be used.
>>
>> What makes you think that? There are plenty of containers that you could
>> use for this:
>>
>> Border
>> GridPane
>> StackPane
>> TablePane
>> TabPane
>> Window
>>
>> You have to set an explicit preferred size *somewhere*, but that is
>> generally done at the top level on Window, either via the "maximized" flag
>> or via the pref. size properties.
>>
>> > I think I'll just have to listen to width and height changes and then
>> set the preferred sizes manually.
>>
>> You can do that, but as I said, it's really not the "right" way to do it.
>>
>>
>
>

Re: A split pane inside any other pane seems not to work?

Posted by Greg Brown <gk...@verizon.net>.
Correct. You probably don't want to put the SplitPane in a hierarchy where you have a BoxPane as an ancestor. I'd recommend using a TablePane instead of a BoxPane in this case.

On Mar 7, 2011, at 10:32 AM, Daniel Ziltener wrote:

> Actually, I can wrap the SplitPane with whatever I want, as long as there is a BoxPane involved in layouting it doesn't work.
> Right now I have the following hierarchy up to the problematic SplitPane:
> Window -> Border -> FlowPane -> BoxPane -> StackPane -> SplitPane. And the SplitPane apparently gets a height of 0 as long as neither the SplitPane nor any of the contained components get an explicit preferredWidth.
> 
> 2011/3/7 Greg Brown <gk...@verizon.net>
> > Apparently such a container is non-existent and preferredWidth and preferredHeight has to be used.
> 
> What makes you think that? There are plenty of containers that you could use for this:
> 
> Border
> GridPane
> StackPane
> TablePane
> TabPane
> Window
> 
> You have to set an explicit preferred size *somewhere*, but that is generally done at the top level on Window, either via the "maximized" flag or via the pref. size properties.
> 
> > I think I'll just have to listen to width and height changes and then set the preferred sizes manually.
> 
> You can do that, but as I said, it's really not the "right" way to do it.
> 
> 


Re: A split pane inside any other pane seems not to work?

Posted by Daniel Ziltener <zi...@lyrion.ch>.
Actually, I can wrap the SplitPane with whatever I want, as long as there is
a BoxPane involved in layouting it doesn't work.
Right now I have the following hierarchy up to the problematic SplitPane:
Window -> Border -> FlowPane -> BoxPane -> StackPane -> SplitPane. And the
SplitPane apparently gets a height of 0 as long as neither the SplitPane nor
any of the contained components get an explicit preferredWidth.

2011/3/7 Greg Brown <gk...@verizon.net>

> > Apparently such a container is non-existent and preferredWidth and
> preferredHeight has to be used.
>
> What makes you think that? There are plenty of containers that you could
> use for this:
>
> Border
> GridPane
> StackPane
> TablePane
> TabPane
> Window
>
> You have to set an explicit preferred size *somewhere*, but that is
> generally done at the top level on Window, either via the "maximized" flag
> or via the pref. size properties.
>
> > I think I'll just have to listen to width and height changes and then set
> the preferred sizes manually.
>
> You can do that, but as I said, it's really not the "right" way to do it.
>
>

Re: A split pane inside any other pane seems not to work?

Posted by Greg Brown <gk...@verizon.net>.
> Apparently such a container is non-existent and preferredWidth and preferredHeight has to be used.

What makes you think that? There are plenty of containers that you could use for this:

Border
GridPane
StackPane
TablePane
TabPane
Window

You have to set an explicit preferred size *somewhere*, but that is generally done at the top level on Window, either via the "maximized" flag or via the pref. size properties.

> I think I'll just have to listen to width and height changes and then set the preferred sizes manually.

You can do that, but as I said, it's really not the "right" way to do it.


Re: A split pane inside any other pane seems not to work?

Posted by Daniel Ziltener <zi...@lyrion.ch>.
Apparently such a container is non-existent and preferredWidth and
preferredHeight has to be used. I think I'll just have to listen to width
and height changes and then set the preferred sizes manually.

2011/3/5 Greg Brown <gk...@verizon.net>

> You don't want to use binding to set the width and height - that's what
> layout managers are for. The problem is that SplitPane doesn't have a
> preferred size (it is 0x0), so you need to put it in a container that will
> give it a size regardless of its preferred size value.
>
> On Mar 5, 2011, at 11:41 AM, Daniel Ziltener wrote:
>
> In that case there is one thing that really is missing: The possibility to
> bind width and height (It tells me it isn't possible to use property binding
> with those)
>
> 2011/3/5 Daniel Ziltener <zi...@lyrion.ch>
>
>> Yes, that works, thank you.
>>
>> 2011/3/5 Chris Bartlett <cb...@gmail.com>
>>
>> This has come up on the mailing list before, but I can't remember the
>>> details off the top of my head.
>>>
>>> Daniel,
>>>
>>> I think you need to provide a preferredWidth & preferredHeight or perhaps
>>> minimumWidth & minimumHeight.
>>>
>>> Anyway, this works for me.
>>>
>>> <Window title="Split Pane - Preferred Size" maximized="true" xmlns:bxml="
>>> http://pivot.apache.org/bxml" xmlns="org.apache.pivot.wtk">
>>> <BoxPane styles="{padding:8}">
>>> <SplitPane splitRatio="0.5" preferredWidth="400" preferredHeight="400">
>>> <left>
>>> <Border title="Left" />
>>> </left>
>>> <right>
>>> <Border title="Right" />
>>> </right>
>>> </SplitPane>
>>> </BoxPane>
>>> </Window>
>>>
>>> Chris
>>>
>>> On 5 March 2011 22:42, Daniel Ziltener <zi...@lyrion.ch> wrote:
>>>
>>>> I'm trying to put a SplitPane inside a BoxPane, but this doesn't work. I
>>>> tried literally everything, from wrapping it inside another container before
>>>> putting it inside the BoxPane over manually setting the size but nothing
>>>> works. It seems like it gets a height of 0, even when manually setting it to
>>>> another value. It only seems to work when put in the Window tag as the only
>>>> component.
>>>> What am I doing wrong?
>>>>
>>>
>>>
>>
>
>

Re: A split pane inside any other pane seems not to work?

Posted by Greg Brown <gk...@verizon.net>.
You don't want to use binding to set the width and height - that's what layout managers are for. The problem is that SplitPane doesn't have a preferred size (it is 0x0), so you need to put it in a container that will give it a size regardless of its preferred size value.

On Mar 5, 2011, at 11:41 AM, Daniel Ziltener wrote:

> In that case there is one thing that really is missing: The possibility to bind width and height (It tells me it isn't possible to use property binding with those)
> 
> 2011/3/5 Daniel Ziltener <zi...@lyrion.ch>
> Yes, that works, thank you.
> 
> 2011/3/5 Chris Bartlett <cb...@gmail.com>
> 
> This has come up on the mailing list before, but I can't remember the details off the top of my head.
> 
> Daniel,
> 
> I think you need to provide a preferredWidth & preferredHeight or perhaps minimumWidth & minimumHeight.
> 
> Anyway, this works for me.
> 
> <Window title="Split Pane - Preferred Size" maximized="true" xmlns:bxml="http://pivot.apache.org/bxml" xmlns="org.apache.pivot.wtk">
> <BoxPane styles="{padding:8}">
> <SplitPane splitRatio="0.5" preferredWidth="400" preferredHeight="400">
> <left>
> <Border title="Left" />
> </left>
> <right>
> <Border title="Right" />
> </right>
> </SplitPane>
> </BoxPane>
> </Window>
> 
> Chris
> 
> On 5 March 2011 22:42, Daniel Ziltener <zi...@lyrion.ch> wrote:
> I'm trying to put a SplitPane inside a BoxPane, but this doesn't work. I tried literally everything, from wrapping it inside another container before putting it inside the BoxPane over manually setting the size but nothing works. It seems like it gets a height of 0, even when manually setting it to another value. It only seems to work when put in the Window tag as the only component.
> What am I doing wrong?
> 
> 
> 


Re: A split pane inside any other pane seems not to work?

Posted by Daniel Ziltener <zi...@lyrion.ch>.
In that case there is one thing that really is missing: The possibility to
bind width and height (It tells me it isn't possible to use property binding
with those)

2011/3/5 Daniel Ziltener <zi...@lyrion.ch>

> Yes, that works, thank you.
>
> 2011/3/5 Chris Bartlett <cb...@gmail.com>
>
> This has come up on the mailing list before, but I can't remember the
>> details off the top of my head.
>>
>> Daniel,
>>
>> I think you need to provide a preferredWidth & preferredHeight or perhaps
>> minimumWidth & minimumHeight.
>>
>> Anyway, this works for me.
>>
>> <Window title="Split Pane - Preferred Size" maximized="true" xmlns:bxml="
>> http://pivot.apache.org/bxml" xmlns="org.apache.pivot.wtk">
>> <BoxPane styles="{padding:8}">
>> <SplitPane splitRatio="0.5" preferredWidth="400" preferredHeight="400">
>> <left>
>> <Border title="Left" />
>> </left>
>> <right>
>> <Border title="Right" />
>> </right>
>> </SplitPane>
>> </BoxPane>
>> </Window>
>>
>> Chris
>>
>> On 5 March 2011 22:42, Daniel Ziltener <zi...@lyrion.ch> wrote:
>>
>>> I'm trying to put a SplitPane inside a BoxPane, but this doesn't work. I
>>> tried literally everything, from wrapping it inside another container before
>>> putting it inside the BoxPane over manually setting the size but nothing
>>> works. It seems like it gets a height of 0, even when manually setting it to
>>> another value. It only seems to work when put in the Window tag as the only
>>> component.
>>> What am I doing wrong?
>>>
>>
>>
>

Re: A split pane inside any other pane seems not to work?

Posted by Daniel Ziltener <zi...@lyrion.ch>.
Yes, that works, thank you.

2011/3/5 Chris Bartlett <cb...@gmail.com>

> This has come up on the mailing list before, but I can't remember the
> details off the top of my head.
>
> Daniel,
>
> I think you need to provide a preferredWidth & preferredHeight or perhaps
> minimumWidth & minimumHeight.
>
> Anyway, this works for me.
>
> <Window title="Split Pane - Preferred Size" maximized="true" xmlns:bxml="
> http://pivot.apache.org/bxml" xmlns="org.apache.pivot.wtk">
> <BoxPane styles="{padding:8}">
> <SplitPane splitRatio="0.5" preferredWidth="400" preferredHeight="400">
> <left>
> <Border title="Left" />
> </left>
> <right>
> <Border title="Right" />
> </right>
> </SplitPane>
> </BoxPane>
> </Window>
>
> Chris
>
> On 5 March 2011 22:42, Daniel Ziltener <zi...@lyrion.ch> wrote:
>
>> I'm trying to put a SplitPane inside a BoxPane, but this doesn't work. I
>> tried literally everything, from wrapping it inside another container before
>> putting it inside the BoxPane over manually setting the size but nothing
>> works. It seems like it gets a height of 0, even when manually setting it to
>> another value. It only seems to work when put in the Window tag as the only
>> component.
>> What am I doing wrong?
>>
>
>

Re: A split pane inside any other pane seems not to work?

Posted by Chris Bartlett <cb...@gmail.com>.
This has come up on the mailing list before, but I can't remember the
details off the top of my head.

Daniel,

I think you need to provide a preferredWidth & preferredHeight or perhaps
minimumWidth & minimumHeight.

Anyway, this works for me.

<Window title="Split Pane - Preferred Size" maximized="true" xmlns:bxml="
http://pivot.apache.org/bxml" xmlns="org.apache.pivot.wtk">
<BoxPane styles="{padding:8}">
<SplitPane splitRatio="0.5" preferredWidth="400" preferredHeight="400">
<left>
<Border title="Left" />
</left>
<right>
<Border title="Right" />
</right>
</SplitPane>
</BoxPane>
</Window>

Chris

On 5 March 2011 22:42, Daniel Ziltener <zi...@lyrion.ch> wrote:

> I'm trying to put a SplitPane inside a BoxPane, but this doesn't work. I
> tried literally everything, from wrapping it inside another container before
> putting it inside the BoxPane over manually setting the size but nothing
> works. It seems like it gets a height of 0, even when manually setting it to
> another value. It only seems to work when put in the Window tag as the only
> component.
> What am I doing wrong?
>