App Designer button callback

조회 수: 2 (최근 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 CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by