Inserting Widgets in layout with ForLoop cause Freeze
-
We need some more information - how many widgets do you create? What do the widgets do? Some example code to reproduce the issue.
-
@mahd96
Yes, @aha_1980 will mean something like that. Along the lines of: set the timer to a short period, each time it ticks pull, say, 10 widgets off your queue and insert, then the next batch comes a hundredth of a second later or whatever. By doing that the UI will not "freeze" from the user's point of view. Of course, if the user interacts with your page after the first bunch of widgets have been placed but before the rest have been added, you may not be a good place, so you will have to do something suitable about that....Just how long is your 100 widgets taking? Is the content of certain ones what is costly? Don't forget that, for example, if you are populating them with a list or images which are taking time, you can rearrange to place them initially with empty content and then do the costly population in the background/on a timer. Like web pages arrive initially, and only afterward the pictures get filled in, etc.