Author Topic: Scroll Bar's size won't update  (Read 2938 times)

Tiras

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Scroll Bar's size won't update
« on: May 16, 2014, 05:26:08 AM »
Hi guys.
I have an UIGrid in a ScrollView with an Scroll Bar attached to it.
the windows is data driven so I load dynamicaly content to the grid on run time.
The thing is that the size of the scrollbar is set to 0 on start unless I scroll the table with my mouse.
But I want my scroll bar size set to the correct size after the content's loading.

Best regards.
Sorry for my English.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scroll Bar's size won't update
« Reply #1 on: May 16, 2014, 02:31:12 PM »
You need to call UpdateScrollbars() on the scroll view after populating it with content.

Tiras

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Scroll Bar's size won't update
« Reply #2 on: May 17, 2014, 12:49:43 PM »
Thank you for the answers but call that fonction after repopulate the grid haven't change a thing. I figure out by myself that maybe the scroll bar isn't initialized when I called it (I tried call UpdateScrollbars() in Start and OnAwake). So I made a coroutine to wait the first frame.
  1. IEnumerator UpdateScrollbarsDelayed(){
  2.    yield return new WaitForEndOfFrame();
  3.    table.UpdateScrollbars(true);
  4. }

Thank you for the great and fast support.