Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: wallabie on May 19, 2014, 10:58:11 AM

Title: How to tell when ScrollView has finished populating.
Post by: wallabie 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.
Title: Re: How to tell when ScrollView has finished populating.
Post by: ArenMook 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?
Title: Re: How to tell when ScrollView has finished populating.
Post by: wallabie 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.

 
Title: Re: How to tell when ScrollView has finished populating.
Post by: Nicki 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.
Title: Re: How to tell when ScrollView has finished populating.
Post by: wallabie on May 19, 2014, 10:41:21 PM
Thanks for the info.