• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Using TLFTextfield and UIScrollbar ... A bug?

Guest
Jun 01, 2012 Jun 01, 2012

Copy link to clipboard

Copied

Hi,

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....

TOPICS
Text layout framework

Views

3.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 06, 2012 Jun 06, 2012

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines