Author Topic: How to tell when ScrollView has finished populating.  (Read 10700 times)

wallabie

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 200
    • View Profile
How to tell when ScrollView has finished populating.
« on: May 19, 2014, 10:58:11 AM »
Use case:

ScrollView is dynamically populated, after it's populated, I need a  toggle a particular item to be highlighted.  Is there an event that's fired when the Scrollview has finished populating itself.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to tell when ScrollView has finished populating.
« Reply #1 on: May 19, 2014, 12:19:58 PM »
Scroll view doesn't populate itself. You are the one who populates it, so I am not sure what you mean?

wallabie

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 200
    • View Profile
Re: How to tell when ScrollView has finished populating.
« Reply #2 on: May 19, 2014, 02:24:02 PM »
Yes, I realize that I am populating it myself.  Then after it's populated, I'm calling Reposition() and ResetPosition().  These methods take time to do the layout.  I don't want to mention anymore names of other GUI competitors, but usually there is a event that one can subscribe to let us know when all of the layout work has been completed. 

In this use case, I need to highlight one of the items in the scrollView after everything has been laid out.  The hack I'm using now is to call a coRoutine to wait for some time interval after the call to Reposition().  It's much better for the ScrollView to let us know when it has done its work.

 

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: How to tell when ScrollView has finished populating.
« Reply #3 on: May 19, 2014, 04:59:20 PM »
They don't take "time" as such, they take a frame, since the Panel has to create the UIDrawCall that actually draws it on screen.

As soon as you've done your "PopulateMethod();" you should be able to do what you need to do following.

You can also force the UIPanel to refresh by calling its Refresh method or BroadcastMessage("CreatePanel") on it.

wallabie

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 200
    • View Profile
Re: How to tell when ScrollView has finished populating.
« Reply #4 on: May 19, 2014, 10:41:21 PM »
Thanks for the info.