ScrollBar Issue
« on: 08 February 2015, 00:00:47 »
How can I set all scrollbars to be at the top? Current when I click on an object to change the content of a textbox the scrollbar is set all the way to the bottom, I'd prefer the opposite where it goes to the top.

*

texus

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: ScrollBar Issue
« Reply #1 on: 08 February 2015, 00:04:10 »
There is no way to control the scrollbar directly.

But it can be done indirectly in this case. After you set the text in the textbox, call the following:
textbox->setSelectionPointPosition(0);

Re: ScrollBar Issue
« Reply #2 on: 08 February 2015, 01:21:42 »
Is that in the documentation? I looked before I asked here.

In any case it works perfectly, thank you.

*

texus

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: ScrollBar Issue
« Reply #3 on: 08 February 2015, 01:51:04 »
The function itself is documented, but what you wanted to do is not. There is no relation with the scrollbar being moved, so it couldn't really be found.

I will add the following to the documentation of the function. That way someone might be able to find it in the future if they look for the word "scrollbar" in the documentation of the text box.
Quote
If the selection point is outside the visible area, the text box will scroll to show the part where the selection point is located. So calling setSelectionPointPosition(0) will always make the scrollbar go completely to the top.

Re: ScrollBar Issue
« Reply #4 on: 08 February 2015, 02:03:22 »
Oh I saw that function but didn't know that determined the location of the scrollbar, too.