필터 지우기
필터 지우기

is it possible to know if an alert dialog box has opened in app designer app?(testing purposes)

조회 수: 13 (최근 30일)
I have a loop that loads data form a dropdown list. For some values an alert dialog box is created that says that the data couldnt load due to some whatever reasons. If the alert dialog box is opened I would like
1. to skip the iteration without making the verification test
2. dismissAlertDialog
So is that possible?
Thanks in advance

채택된 답변

Bruno Luong
Bruno Luong 2021년 9월 23일
Check out function ishandle

추가 답변 (2개)

Geoff Hayes
Geoff Hayes 2021년 9월 23일
Michaela - if your code launches the alert dialog, then you should be able to know that it has launched and so can "skip the iteration without making the verification test". You can dismiss the dialog if you save the handle to it. For example, from warning dialog you can do
hWarnDlg = warndlg('Uh oh','Warning');
and then close it with
close(hWarnDlg);
though you will have to be careful in case the user closes the dialog which would make hWarnDlg invalid.
  댓글 수: 11
Bruno Luong
Bruno Luong 2021년 10월 4일
편집: Bruno Luong 2021년 10월 4일
It's still possible if the Alert box has distinctive characteristic:
warndlg('Uh oh','Alert','non-modal');
pause(3)
hWarnDlg = findall(0,'Name','Alert'); delete(hWarnDlg)
Michaela Konstantinou
Michaela Konstantinou 2021년 10월 4일
I just used timer, matlab.uitest.unlock and java.awt.robot for pressing enter for now. I will also check your reccomendations, thank you

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


Image Analyst
Image Analyst 2021년 9월 23일
You can set some flag, like "inBatchMode" to true or false and then only show the warning popup message if the flag is set to false, like
if ~inBatchMode
% Only show popup message if not in batch processing mode.
% Only show in interactive mode. Tell them what file was missing or
% bad.
warningMessage = sprintf('Error reading file %s', fullFileName);
uiwait(warndlg(warningMessage));
end

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by