4 Replies Latest reply on Jun 22, 2009 7:10 AM by Mongolian Beef

    scrollbar dilemma

    Mongolian Beef

      Hi,

       

      I have a Form within a TitleWindow.  The Form contains dynamic inputs (depending on who is using the application).  Sometimes all the inputs fit in the window, other times it requires a vertical scroll bar (on titleWindow) to be able to see all of the inputs.  Now, according to the Flex 3 api, the form container defaults the paddings (r/l/t/b) to 16.  I see this accurately when there is no scroll bar.  However, when there is a vertical scroll bar, it overlaps the paddingRight such that it seems there is no more padding on the right.  In the flex docs, it mentions this and the only way to have the padding calculated correctly with the scroll bar is to actually set the scrollbar to be ON-- not auto.  Hence my dilemma.  Autoscrolling works perfectly but affects the padding of my form.  If I set scrolling to be always on, the padding is always correct but there will be times when the scrollbar appears but is disabled since there is nothing to scroll.

       

      Is there a way to, before the form gets loaded, determine if there is a need for a scrollbar?  In this way, I can then force the scroll bar to be on if so, otherwise don't do anything.  Or if there are other ways, let me know.  Thanks.

       

      -los

        • 1. Re: scrollbar dilemma
          leybniz Level 4

          on TitleWindow creationComplete you could check

          if (this.verticalScrollBar)

               setStyle('paddingRight', getStyle('paddingRight') + this.verticalScrollBar.width);

          1 person found this helpful
          • 2. Re: scrollbar dilemma
            Mongolian Beef Level 1

            Hmm... I see what you are saying.  Was wondering if I can apply this to states as well?  My title window contains the form with a few states (each state being a 'different' form).  Thanks.

             

            -los

            • 3. Re: scrollbar dilemma
              leybniz Level 4

              I see your intention, ok this way you could find a luck by doing this:

               

              in your TitleWindow paste this:

               

               

              override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {

                   super.updateDisplayList(unscaledWidth, unscaledHeight);

               

                   if (verticalScrollBar && getStyle('paddingRight') == /* initial padding set by you*/)

                        setStyle('paddingRight', getStyle('paddingRight') + verticalScrollBar.width);

                   else

                        setStyle('paddingRight', /* initial padding set by you*/);

              }

               

              hope this helps
              • 4. Re: scrollbar dilemma
                Mongolian Beef Level 1

                No, none of the above actually works.  It seems as if the width of the TitleWindow gets calculated and overrides any padding settings, i.e. the code above has no effect on the sizing of the TitleWindow and the verticalScrollBar bleeds into the Form.  Not sure how to make this work so I'll probably have to put this aside.  Thanks for your help anyway.

                 

                -los