views:

675

answers:

1

Hey

I would like to have that the height of a canvas change automatically. When there are a lot of labels and images in my canvas, the height must increase. And when there are just a few labels in the canvas, the height must decrease.

In fact i want something like in CSS: height: auto;

I hope youn understand my question.

Thanks in advance Vincent

+2  A: 

This is one of those 'how long is a piece of string?' questions. Because the Canvas component doesn't perform layout management for its children in the same way that a VBox or HBox does (that is, the positioning of the children is left up to you) it is also up to you to you to determine the size of the Canvas based on your own layout rules.

If you are linearly laying the children out vertically or horizontally then you should be able to swap the Canvas for a VBox or HBox - those components can automatically resize to show all of their contents.

How are you laying out the labels and images in your Canvas at the moment?

Sly_cardinal