Main Content

Update Dialog Boxes

Add dialog boxes to your uifigure-based app by using functions such as uialert and uiconfirm. These dialog box functions are specifically configured to be used in apps. Creating dialog boxes using functions such as errordlg and questdlg will continue to be supported. However, there are benefits to using dialog boxes specific to app building. These dialog boxes have additional customization options, including:

  • The ability to specify a custom icon

  • The ability to format text using HTML or LaTeX markup

  • The ability to write a callback that executes when the dialog box is closed

Also, these dialog boxes are displayed within the UI figure window that makes up your app.

Alert dialog box in a UI figure window. The app is visible behind the dialog box.

To take advantage of these benefits, as you transition your figure-based app to use the uifigure function, update the functions you call to create dialog boxes for your app. This table lists the functions available for creating dialog boxes in figure-based apps and the corresponding functions configured for uifigure-based apps.

figure-Based Appsuifigure-Based Apps
FunctionExampleFunctionExample
errordlg
errordlg("Operation unsuccessful","Error");

figure-based error dialog box

uialert
fig = uifigure;
uialert(fig,"Operation unsuccessful","Error")

uifigure-based error dialog box

warndlg
warndlg("This operation cannot be undone","Warning");

figure-based warning dialog box

uialert
fig = uifigure;
uialert(fig,"This operation cannot be undone","Warning", ...
    "Icon","warning")

uifigure-based warning dialog box

msgbox
msgbox("Operation completed","Done","modal");

figure-based message dialog box

uialert
fig = uifigure;
uialert(fig,"Operation completed","Done", ...
    "Icon","none")

uifigure-based message dialog box

helpdlg
helpdlg("Consider using a cell array","Data Types");

figure-based help dialog box

uialert
fig = uifigure;
uialert(fig,"Consider using a cell array","Data Types", ...
    "Icon","info")

uifigure-based help dialog box

questdlg
questdlg("Do you want to continue?","Confirm");

figure-based question dialog box

uiconfirm
fig = uifigure;
uiconfirm(fig,"Do you want to continue?","Confirm", ...
    "Options",["Yes" "No" "Cancel"])

uifigure-based question dialog box

waitbar
waitbar(0.3,"Loading...","Name","Please Wait");

figure-based progress dialog box

uiprogressdlg
fig = uifigure;
uiprogressdlg(fig,"Value",0.3, ...
    "Message","Loading...", ...
    "Title","Please Wait");

uifigure-based progress dialog box

Related Topics