Main Content

dismissAlertDialog

Class: matlab.uitest.TestCase
Package: matlab.uitest

Close frontmost alert dialog box in figure window

Description

example

dismissAlertDialog(testcase,fig) closes the frontmost alert dialog box in the specified figure window.

Input Arguments

expand all

Instance of the test case, specified as a matlab.uitest.TestCase object.

Target figure, specified as a matlab.ui.Figure object. The figure must be created with the uifigure function.

Attributes

Sealedtrue

To learn about attributes of methods, see Method Attributes.

Examples

expand all

Create a modal alert dialog box. The figure behind the dialog box is inaccessible until you close the dialog box.

fig = uifigure;
uialert(fig,'File not found','Invalid File')

A figure window behind an alert dialog box

Create an interactive test case and close the alert dialog box. The dialog box disappears, and the figure behind it is accessible again.

tc = matlab.uitest.TestCase.forInteractiveUse;
tc.dismissAlertDialog(fig)

A figure window after closing the alert dialog box

Introduced in R2021a