How to close an uialert programmatically

조회 수: 6 (최근 30일)
Arthur Roué
Arthur Roué 2020년 7월 23일
편집: Ali Nateghi 2021년 12월 12일
I'm developping some tests with the matlab.uitest framework. Everything is fine until my app generates an uialert, which is expected behavior.
The problem is, once uialert pop-up is there, I can't do any more gesture (choose, press, drag...). If I unlock the app and close the uialert manually (with matlab.uitest.unlock(fig)), then everything is fine again.
So, do you know any way to close an uialert programmatically ?

채택된 답변

Adam Danz
Adam Danz 2020년 7월 28일
편집: Adam Danz 2020년 7월 28일
The uialert window cannot be programmatically closed, at least not in r2020a. You can, however, make the uialert non-modal which will allow you to interact with the base figure (app) while the uialert still exists.
uialert(uifig, 'message', 'title', 'Modal', false)
Alternatively, you could use a msgbox which outputs a handle that you can use to delete at any time but this will not be automatically centered on the app like the uialert panel does.
  댓글 수: 2
Arthur Roué
Arthur Roué 2020년 7월 28일
Oh yes, thank you, didnt think of Modal property !
Ali Nateghi
Ali Nateghi 2021년 12월 12일
편집: Ali Nateghi 2021년 12월 12일
hi
use this code instead:
d=uiprogressdlg(app.UIFigure,'Message',message,'Title',title,...
'Icon','error','Cancelable','on','Indeterminate','on');
for i=5:-1:1
d.Message=[num2str(i) ' seconds to close ' ];
pause(1)
end
close(d)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Parallel Server에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by