5 Replies Latest reply on Feb 1, 2008 9:14 PM by greenhippo

    change size of a canvas

    greenhippo
      Hi,

      Is there an easy way to set the internal size of a canvas without populating it with children?

      I can achieve the affect im after by placing a child within the canvas and setting the child to the size i want, such that the canvas will be drawn with scroll bars. But im looking for a cleaner way to do it. As this is for a component im making i dont mind having to override methods to get this affect i just need to know which ones to override, or which properties need to be set

      Thanks for any help
        • 1. Re: change size of a canvas
          ntsiii Level 3
          Perhaps I am not understanding, but you can explictily set the widht and height properties of a Canvas.

          Tracy
          • 2. Re: change size of a canvas
            greenhippo Level 1
            I can set the height and width of the canvas so that it displays on the screen at that height and width.

            But i want to set the height and width of its contents, without having to actually place a child inside the canvas. Such that an empty canvas would have scroll bars that could scroll around.

            Hope that helps clear up my query
            • 3. Re: change size of a canvas
              ntsiii Level 3
              You can set horizontal and vertical scrollPolicy to on, which will show scroll bars, but if there is nothing to scroll, ie no children, well, there will be nothing to scroll.
              • 4. Re: change size of a canvas
                ntsiii Level 3
                What are you trying to accomplish?
                • 5. Re: change size of a canvas
                  greenhippo Level 1
                  I am trying to develop a component, that is based on a canvas that will be drag scrollable with the mouse, similar to various mapping components such as yahoo maps and google maps. I want the internal components of the canvas to only be loaded when they will be shown.

                  The problem is that they are not always present in the canvas so the internal space in the canvas appears smaller than it actually is because the components are not created yet. You are unable to scroll around as it thinks there are no components there, when they will be there but just not created quite yet.