11 Replies Latest reply on Jan 21, 2008 2:17 AM by mattkane

    Fixed percentageHeight?

      I want to set a FIXED percentageHeight. As it is now, if you set a box's percentageHeight, and then a child gets added later on, or one of the children gets bigger, then the box will expand, taking up more than the percentage you had set it to.

      How I do I set a permanent percentageheight, so that it just scrolls rather than expanding?

      Is there something like an onOneOfMyChildrenChanged event? So I can reset percentageheight... And I'd need an OnParentChanged too I guess. I'd need an onAnythingChanged basically.



        • 1. Re: Fixed percentageHeight?
          jayproulx Level 1
          You can set the verticalScrollPolicy to on or auto to force it to scroll.
          • 2. Re: Fixed percentageHeight?
            Thanks but that's not the problem. The problem is the height of the box, not whether or not scrollbars appear.
            • 3. Re: Fixed percentageHeight?
              brado77
              Tank,

              Have you tried setting the explicitHeight and explicitMaxHeight properties on the Box?

              Brad
              1 person found this helpful
              • 4. Re: Fixed percentageHeight?
                brado, exlicitHeight isn't a percentage. If I set explicitHeight, and the size of the parent container changes, I want the box to take up the same percentage, not explicit pixel size.
                • 5. Re: Fixed percentageHeight?
                  brado77 Level 1
                  TankMan,

                  quote:

                  brado, exlicitHeight isn't a percentage. If I set explicitHeight, and the size of the parent container changes, I want the box to take up the same percentage, not explicit pixel size.


                  You are correct. Based on your original post, I had thought that you didn't like the fact that the box was changing size:

                  quote:

                  As it is now, if you set a box's percentageHeight, and then a child gets added later on, or one of the children gets bigger, then the box will expand, taking up more than the percentage you had set it to.


                  My bad -- I understand it is the percentage change that it is the problem. I actually may be encountering this in one of my apps as well. Let me ask you this, how are you verifying what the new percentage height actually is? Can you output the percentageHeight set on the box after the change occurs, to see what the new value is?

                  The two possibilities are that 1) the percentageHeight is what you set it to originally, in which case then it would help to verify the box parent's pixel height and the box's pixel height to determine the percentage, or 2) the percentageHeight has been changed internally somewhere, which might be a bug.

                  One thing to look out for -- I've had similar apparent rendering anomalies caused not by bad rendering of the component in question, but by changes in the component's parent's other children, which caused the parent to be resized in such a way where I didn't realize by looking at it that the parent was taking up more or less real estate than it actually was. It turned out my problem wasn't with the component I was concerned with, it was with the parent component which contained it.

                  Hope that helps some....

                  B
                  1 person found this helpful
                  • 6. Re: Fixed percentageHeight?
                    I tested and-

                    The percentageHeight still claims to be 50 (after big components are added into it), even though the box is taking up the entire height of it's parent's space.
                    • 7. Re: Fixed percentageHeight?
                      bump. someone from adobe want to acknowledge this bug?
                      • 8. Re: Fixed percentageHeight?
                        bump
                        • 9. Re: Fixed percentageHeight?
                          mattkane
                          I see in the developer guide (page 153 of the Flex 3 guide) that:

                          "A percentage-based container size is advisory. Flex makes the container large enough to fit its children at their
                          minimum sizes. "

                          Is there any way of changing this behaviour? I have a Panel in an AIR app with a height of 100%. When the content height is large enough to cause the Panel to be taller than the window, the whole Application expands (causing the window to get scrollbars), rather than the Panel clipping its content and getting its own scrollbars. This is obviously not the desire behaviour.

                          I can fix it by setting a fixed size on the Panel, but that's not what I want. I want the Panel to resize with the window, clipping its content if needed. Please, Adobe people, does anyone have a solution?
                          • 10. Re: Fixed percentageHeight?
                            Flex harUI Adobe Employee
                            Set whatever percentage you want, then set minWidth and/or minHeight on the Panel to 0 or some small number. That will let the Panel shrink below its measurements of this content and it should show scrollbars instead of the application.
                            1 person found this helpful
                            • 11. Re: Fixed percentageHeight?
                              mattkane Level 1
                              quote:

                              Originally posted by: Flex harUI
                              Set whatever percentage you want, then set minWidth and/or minHeight on the Panel to 0 or some small number. That will let the Panel shrink below its measurements of this content and it should show scrollbars instead of the application.


                              Doesn't seem to work, I'm afraid. But I think I've found a solution:

                              <mx:VBox height="100%" id="myWrapper">
                              <mx:Panel maxHeight="{myWrapper.height - 50}">
                              ...something tall..
                              </mx:Panel>
                              </mx:VBox>

                              Binding the height to just the height of the wrapper doesn't seem to work, but subtracting an amount from it seems to.