App Designer button callback

5 ビュー (過去 30 日間)
Derek Handwerk
Derek Handwerk 2019 年 4 月 2 日
コメント済み: Rik 2020 年 2 月 21 日
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?

採用された回答

Rik
Rik 2019 年 4 月 2 日
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 件のコメント
Evan Bates
Evan Bates 2020 年 2 月 21 日
Is this still the solution? I have the same problem.
Rik
Rik 2020 年 2 月 21 日
I would expect so. Have you tried it?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by