dialog

Create and display empty dialog box

Syntax

h = dialog('PropertyName',PropertyValue,...)

Description

h = dialog('PropertyName',PropertyValue,...) returns a handle to a dialog box. The dialog box is a figure graphics object with properties recommended for dialog boxes. You can specify any valid figure property value except DockControls, which is always off.

The following table contains the properties that dialog sets and their default values.

PropertyValue
ButtonDownFcn'if isempty(allchild(gcbf)), close(gcbf), end'
Colormap[]
ColorDefaultUicontrolBackgroundColor
DockControls'off'
HandleVisibility'callback'
IntegerHandle'off'
InvertHardcopy'off'
MenuBar'none'
Number[]
NumberTitle'off'
PaperPositionMode'auto'
Resize'off'
Visible'on'
WindowStyle'modal'

    Note:   By default, the dialog box is modal. A modal dialog box prevents users from interacting with other windows before responding to the modal dialog box. For more information, see WindowStyle in Figure Properties.

The default ButtonDownFcn value causes the dialog box to terminate itself when a user clicks it, if the dialog box contains no child objects. Replace the default ButtonDownFcn value with another value or an empty value if you do not want this behavior. You can do this only from a script or function if the dialog box is modal (the default WindowStyle).

Any property you can specify for the figure function is valid for the ButtonDownFcn function.

Examples

Default modal dialog box

out = dialog;

Nonmodal dialog box

Create a nonmodal dialog box with a name on its title bar.

out = dialog('WindowStyle', 'normal', 'Name', 'My Dialog');

Was this topic helpful?