4 Replies Latest reply on Aug 22, 2007 7:24 AM by Bob Saggot

    Need Hbox to expand to size of screen.

    Bob Saggot Level 1
      I have contents inside my Hbox (its the main content in the center of my page) and i need the bottom of the Hbox to always be at the bottom of the screen ALSO need it to show ALL CONTENT in the HBox...

      So....
      1) if all content CAN fit in the Hbox, the Hbox goes to the bottom of the screen...(extra whitespace)
      2) if all content CANNOT fit in the Hbox, the hbox doesn't just go to the bottom of the screen but expands to the content inside of it. so it'll go until the content stops using the browser scrollbar to reach it (NOT the hbox scroll bar)

      Any easy way of doing this?
        • 1. Re: Need Hbox to expand to size of screen.
          Bob Saggot Level 1
          anybody? is there any way to get the x and y coordinates of the components inside the h box?

          cuz i could find out which one has the highest y value and set that as the hbox's Height
          • 2. Re: Need Hbox to expand to size of screen.
            peterent Level 2
            I don't quite understand what you are trying to do, especially since the HBox is horizontal and won't expand downward, just to the right. If you place the HBox into a container that can do absolute positioning (like Application) you set the HBox's bottom="0" and it will always remain anchored to the bottom of the container. With HBox, if you do not specify a width, it will always resize to fit its content. As you add more contents it will expand to the right. If it extends beyond the Application's boundaries, the Application will acquire scrollbars. If you set the HBox's size, then the HBox will get the scrollbars.
            • 3. Re: Need Hbox to expand to size of screen.
              brischt
              Hi Bob,

              I had a similar problem with a container control (VBox) that hosted a datagrid. The requirement was that the grid will not have a vertical scrollbar by itself but the container control does. In other words, I had to make sure that the datagrid's height is set dynamically just exactly to the value required to display all content, not more and not less.

              I found the best solution to be a method that resizes the datagrid like this:

              this.dg1.height = this.dg1.measureHeightOfItems(-1, _myDataSource.length);

              The method gets called whenever the data is set from outside via a public function.

              There might be some easier way of playing with absolute and relative values for height, maxHeight etc. but I found this to be the easiest way. Maybe you can adapt this to your needs.

              Hope this helps,

              Roland
              • 4. Re: Need Hbox to expand to size of screen.
                Bob Saggot Level 1
                Thanks guys for your solutions!! I played around with both of your ideas, seeing if I should do it programmatically or by the Hbox's properties.

                The final solution was to set the right="0" and bottom = "0" for the hbox and it fixed it!

                makes it so it uses the browsers scrollbars and not the hbox's :)