Creating Graphical User Interfaces    

Launching a Dialog to Confirm an Operation

This example illustrates how to display a dialog when users attempt to close a GUI. The purpose of the dialog is to force the user to confirm that they really want to proceed with the close operation.

Dialog Requirements

You want to protect users from unintentionally closing a GUI application by displaying a confirmation dialog when they press the Close button on the main application window.

You want the dialog to:

The following sections discuss the implementation of this dialog.

View the Layout and Application M-File

Use these links to display the FIG-file in the Layout Editor and the application M-file in the MATLAB Editor. This enables you to see the values of all component properties and to explore how the components are assembled to create the GUI. You can also see the complete code listing.

Click here to display the layout for this GUI in the GUIDE Layout Editor.

Click here to load the application M-file into the MATLAB Editor/Debugger.


 Application Techniques Implementing the GUI