2 Replies Latest reply on Oct 18, 2006 10:13 AM by Matlus

    How to: Canvas "Fit to Size"

    Matlus Level 1
      I have a canvas say that has an image and a few other components on it. They're all layed out using combinations of VBox/HBox etc.

      I have an image on the canvas whose size can vary depending on which image is loaded. I'd like for the (parent) canvas to size itself as per the size of all its children. For the life of me I can't seem to find a way to do this.

      I've set the horiz/verticalscrollpolicy to off because I don't want scroll bars on any side. The image gets clipped and the canvas stays the same size. If I set clipContents to false, the image doesn't get clipped any more but the canvas it still the same size.

      So how would I go about achieving what I need, or is Canvas the wrong component to use?