Author Topic: Label inside a scroll panel. Updated text isn't positioned to top  (Read 1651 times)

jchristof

  • Guest
Are there steps I can take to reset the text and scroll bar both to the top if new text is applied to the label?

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Label inside a scroll panel. Updated text isn't positioned to top
« Reply #1 on: June 20, 2013, 01:38:02 PM »
Automatically? No. Manually? Sure. When you set your text's label, also reset the scroll bar's position.

jchristof

  • Guest
Re: Label inside a scroll panel. Updated text isn't positioned to top
« Reply #2 on: June 20, 2013, 06:18:33 PM »
Right, I guess I was looking for an alternative to this which doesn't seem to position new text to the top of the scroll panel:
  1. GameObject.Find("Label inside the scroll panel").GetComponent<UILabel>().text = Text.getText(text);
  2. GameObject.Find("ScrollBar").GetComponent<UIScrollBar>().scrollValue = 0;
  3. GameObject.Find("ScrollBar").GetComponent<UIScrollBar>().ForceUpdate();

But grabbing and pulling the scrollbar works as expected.
« Last Edit: June 20, 2013, 07:24:42 PM by jchristof »