App Designer button callback

2 vues (au cours des 30 derniers jours)
Derek Handwerk
Derek Handwerk le 2 Avr 2019
Commenté : Rik le 21 Fév 2020
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?

Réponse acceptée

Rik
Rik le 2 Avr 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.
  2 commentaires
Evan Bates
Evan Bates le 21 Fév 2020
Is this still the solution? I have the same problem.
Rik
Rik le 21 Fév 2020
I would expect so. Have you tried it?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by