App Designer button callback

10 views (last 30 days)
Derek Handwerk
Derek Handwerk on 2 Apr 2019
Commented: Rik on 21 Feb 2020
function GOButtonPushed(app, event)
app.Lamp.Color = 'yellow';
% Some long computation.
app.Lamp.Color = 'green';
If I have the above code the lamp never turns yellow. It seems like the UI doensn't refresh until the entire callback finishes.
Is there a way to fix this?

Accepted Answer

Rik on 2 Apr 2019
You can force a graphics update with drawnow, or by introducing a small pause (in general I see people using pause(0.01) or a similar amount of time). Either will flush the queue of graphics updates.
Rik on 21 Feb 2020
I would expect so. Have you tried it?

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!