Documentation Center

  • Trial Software
  • Product Updates


Create and display empty dialog box


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


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.

'ButtonDownFcn''if isempty(allchild(gcbf)), close(gcbf), end'
'Color' DefaultUicontrolBackgroundColor

    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 the MATLAB® 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.


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');

See Also

| | | | | | | | |

Was this topic helpful?