App Designer button callback

function GOButtonPushed(app, event)
app.Lamp.Color = 'yellow';
% Some long computation.
app.Lamp.Color = 'green';
end
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?

 Risposta accettata

Rik
Rik il 2 Apr 2019

0 voti

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.

2 Commenti

Evan Bates
Evan Bates il 21 Feb 2020
Is this still the solution? I have the same problem.
Rik
Rik il 21 Feb 2020
I would expect so. Have you tried it?

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Interactive Control and Callbacks in Centro assistenza e File Exchange

Richiesto:

il 2 Apr 2019

Commentato:

Rik
il 21 Feb 2020

Community Treasure Hunt

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

Start Hunting!

Translated by