Panel Timer best practise
-
Hello everyone,
I wonder if it is ok to set the value of panel 2 in the timer callback of panel 1 or is this a problem and I should use a separate timer for it?
Thank you very much
Oli -
@Oli-Ullmann it’s perfectly fine. Then if you need you trigger the second panel’s callback afterwards, or call a repaint or whatever
-
@ustk
Yes, I call repaintImmediately() in the timer callback after I set the value.Cool, thank you! :-)
-
@Oli-Ullmann
repaintImmediately()
has no more advantage overrepaint()
, it's just still there for compatibility reasons -
@ustk good to know, thank you! :-)
-
@Oli-Ullmann It really depends on the use case. Remember that the panel timers stop when the UI of the plugin is closed. You can test this with the little moon icon in the interface designer.
If this breaks your functionality in any way, use your own timer objects.
-
@aaronventure
Good point, thanks to you! I actually only use it for UI animations. So it's actually useful that the timer is stopped when the UI is closed, as it doesn't consume CPU resources.