I have an issue when loading preset in my personal plugin. Values are set correctly but UI do not refresh using the handleAsyncUpdate method after call of triggerAsyncUpdate method. UI is only correctly shown after user close and reopen plugin.
Is there any possible explanation or any example that demonstrate how juce force update of UI using asynchronous update ?
Well handleAsyncUpdate() gots called? You are self responsible to refresh your ui (for example calling repaint() or whatever it needs to update your UI controls)
If repainting didn't work, no juce plugins would work at all! Must be something you're doing wrong, e.g. repainting the wrong component, blocking the message thread, etc., but impossible for us to guess what.
We experienced a problem in Pro Tools where the messaging didn’t work correctly if MessageManager stuff (timers, async updates, listener notifications etc.) is used before the GUI was created. Maybe something like this is happening here, too.
This could for example be the case if your AudioProcessor is derived from Timer and calls startTimer() in its constructor.
I may add that triggerAsyncUpdate and handleAsyncUpdate are called in a seperate thread. How can i notify principale thread that UI needs to be refreshed ?
When do you start the thread and has the editor been created when you call triggerAsyncUpdate()? If not, this could lead to what I described in my previous post.
hasEditor() only states whether the plugin supplies its own editor and will always return true for most plugins.
Try setting breakpoints in createEditor() and in run() and have a look which breakpoint gets reached first. If the one in run() is reached first, you are probably seeing the issue described in my first post.
We added the following assertion to startTimer(), triggerAsyncUpdate() and similar functions to catch this issue: