Execute code on next frame?
Hello! I find myself needing to get the new size of a stringcontrol after setting the text, but this is impossible to do on the same frame that the text is set because the control doesn't automatically resize until the next frame. Is it possible to somehow execute code a frame later? Or is there already some sort of update function I'm not aware of? Thanks!
here is an example of the issue (spell_text control has no set size or bottom anchor, so it is dynamically sized based on its value):
Code:
window.spell_text.setValue("long description here");
new_size_x, new_size_y = window.spell_text.getSize(); -- unexpected behaviour. Returns the size of the control before setting the text value. This needs to be deferred one frame to get the new size
-- do something with the new size...