MATLAB 帮助中心
类: matlab.uitest.TestCase 命名空间: matlab.uitest
(不推荐)关闭图窗窗口中最前面的警报对话框
自 R2021a 起
不推荐使用 dismissAlertDialog。请改用 dismissDialog。有关更新代码的信息,请参阅版本历史记录。
dismissAlertDialog
dismissDialog
dismissAlertDialog(testCase,fig)
dismissAlertDialog(testCase,fig) 关闭指定图窗窗口中最前面的警报对话框。
testCase
fig
示例
全部展开
matlab.uitest.TestCase
测试用例,指定为 matlab.uitest.TestCase 对象。
matlab.ui.Figure
目标图窗,指定为 matlab.ui.Figure 对象。图窗必须使用 uifigure 函数创建。
uifigure
Sealed
true
要了解方法的属性,请参阅方法属性。
创建一个模态警告对话框。在关闭该对话框之前,无法访问对话框后面的图窗。
fig = uifigure; uialert(fig,"File not found","Invalid File")
创建一个交互式测试用例,并关闭警报对话框。对话框消失,该对话框后面的图窗重新处于可访问状态。
testCase = matlab.uitest.TestCase.forInteractiveUse; testCase.dismissAlertDialog(fig)
全部折叠
不推荐使用 dismissAlertDialog。请改用 dismissDialog。目前没有删除 dismissAlertDialog 的计划。然而,dismissDialog 方法提供的功能更多,并且不限于警报对话框。例如,您可以使用 dismissDialog 方法关闭警报对话框或确认对话框。
下表显示如何更新您的代码以改用 dismissDialog。
fig = uifigure; uialert(fig,"File not found","Invalid File") testCase = matlab.uitest.TestCase.forInteractiveUse; testCase.dismissAlertDialog(fig)
fig = uifigure; uialert(fig,"File not found","Invalid File") testCase = matlab.uitest.TestCase.forInteractiveUse; testCase.dismissDialog("uialert",fig)
uialert | dismissDialog
uialert
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处