1 Reply Latest reply on Jun 6, 2012 2:36 AM by caista1

    Using TLFTextfield and UIScrollbar ... A bug?




      I'm using the TLFTextfield with the UIScrollbar as part of a Chat Application.


      Everything is working fine exept the way the "thumb" on the scroll bar resizes as the height of the TLFTextfield grows.


      As each line is added to the textfield beyond it´s visible boundries the "thumb" shrinks exponentially, so that when there are just three lines of scrollable text, the thumb is already tiny.


      This doesn´t happen if I use a Classic Text Field, where the "thumb" shrinks at a much more gradual rate.


      Comparing the two, it looks like the difference is down to the _maxScrollPosition variable in the ScrollBar. In the Classic Text the _maxScrollPosition refers to the number of lines, where in TLFTextfield it refers to the number of pixels.


      Is this a bug?


      How can I get the UIScrollBar to scroll normally with the TLFTextfield?


      Thanks in advance....

        • 1. Re: Using TLFTextfield and UIScrollbar ... A bug?
          caista1 Level 1

          OK it seems that when the height of the scrollbar is being determined in the function "updateThumb" in ScrollBar.as, it uses the variable _pageSize, which contains the number of lines that a page contains.


          If the TLFTextfield is measuring _maxScrollPosition in pixels then for the thumb to scale properly, _pageSize should also be measured in pixels. But it´s not. Infact it always seems to contain the default 10 value.


          So I extended, UIScrollBar.as and overrode "updateThumb" replacing _pageSize with _scrollTarget.height and everything works as it should now.


          Hope this helps someone