(Probably another) Layout Question

Hi,

I am just struggling getting the layout that I want…

(By the way, I tried searching the forums, but the search functionality doesn’t seem to be working (at least searching for a word in the subject of a message did not find anything…)

Failing the forum search, I have also googled, found some suggestions, but they don’t seem to help me out.

What I would like to do is have a Panel (as my googling suggested that panels and windows are the only things that take scrollbars) that dynamically resizes based on the window size and only shows the scroll bar when required.

Is this possible? (Well, I have found it is with an absolute layout.)

My latest setup that down’t work is pretty much from the GUI designer, so I have:

CustomComponent (set to Full Size)
→ VerticalLayout1 (set to Full Size)
-----> panel (set to 100% height)
--------> VerticalLayout2 (set to auto height (-1))
-----------> various other components set to auto height

I had it working when the CustomComponent had an Absolute layout, but changing to VerticalLayout seems to stop it working.

Forgive my naivety, I am not used to working with Layouts.

Regards
Colin

Instead of this:


CustomComponent (set to Full Size)
[b]
--> VerticalLayout1  (set to Full Size)
[/b]
-----> panel  (set to 100% height)
--------> VerticalLayout2 (set to auto height (-1))
-----------> various other components set to auto height

make it like this:


CustomComponent (set to Full Size)
--> VerticalLayout1  [b]
(set to 100% height)
[/b]
-----> panel  (set to 100% height)
--------> VerticalLayout2 (set to auto height (-1))
-----------> various other components set to auto height

The core layouts will clip any overflowing content, and since you’ve specified the layout as 100%, anything that is bigger than that will get clipped.

You could also remove the VerticalLayout1 if the only thing inside it is the Panel. You can set the Panel as the composition root for the CustomComponent as well .

Thanks Jouni,

That helped me out, though not quite as you would expect…

I set the VerticalLayout1 to 100% as you mentioned (at least I thought I did), but nothing seemed to change… which made me look harder…

I was setting the 100% in the gui designer for VericalLayout1 (the root layout shown in the designer), which upon further inspection does the following:

// top-level component properties
setWidth("100.0%");
setHeight("100.0%");

So, in other words, setting the VerticalLayout1 properties in the designer seems to set the values for the CustomComponent rather than the root layout (which is called mainLayout in code… VerticalLayout1 in code is no where to be seen).

What I needed to do (and perhaps the designer is supposed to do?) is set the height of the mainLayout property (which is the VerticalLayout1 in the designer) to height 100% (setSizeFull() also works) like so:

mainLayout.setSizeFull();

I tried lots of things… but obviously not this, so thanks for helping me look in the right direction.

I will also try setting the root component to be the Panel as the root VerticalLayout1 is indeed not really needed and is just an artifact of initially using the designer.

Regards
Colin