inputsdlg: Enhanced Input Dialog Box

Predefined dialog box function to accept user inputs of several forms

8.7K Downloads

Updated 30 Jun 2015

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

This function is an enhanced version of the standard INPUTDLG function with many additional features:
- 8 control types: text, edit, check, list, range, color, table, button
(**color, table, and button were added in v2.0**)
- Text Type is a static text (e.g., to place an instruction)
- Check Type displays a checkbox with a label, returns one of two values. Value could be logical, integer, or string
- Edit Type can be configured to accept:
* plain text (single- or multi-line mode)
* date (following date formats as defined in DATESTR)
* numeric value (integer or float with attribute specification)
* file or directory name (with UIGETFILE, UIPUTFILE, or UIGETDIR functions, supports UIGETFILE multi-sel
ect mode)
* vector (can specify the length of the vector or the attributes of its elements if the length is fixed or arbitrary). To specify a row vector, include the 'row' keyword in formats.limits field.
- List Type returns index(es) of the selected item and can have 4 different appearances:
* Popupmenu
* Listbox (can be made to multi-select)
* Radiobutton (button placements can be customized)
* Togglebutton (button placements can be customized)
- INPUTSDLG can automatically size controls and dialog box for an optimal appearance, and control's size can be made to auto-adjust if dialog is made resizable.
- INPUTSDLG supports user callbacks to all UI controls as well as dialog's CreateFcn and DeleteFcn callbacks. The callback function takes additional input arguments to standard MATLAB callback arguments.
- INPUTSDLG returns the user entries in a cell or in a structure
- INPUTSDLG is backward compatible with INPUTDLG except for its returned values when canceled. With default answers given, INPUTDLG returns an empty cell while INPUTSDLG returns the default answers. INPUTSDLG returns the second parameter, CANCELED(a logical flag) to indicate how the dialog box is terminated.
ACKNOWLEDGMENT:
- Luke Reisner prepared v1.3 and kindly shared his modification/bug fixes.
- Florian Hatz initiated the development of v2.0 with his ideas of adding table, color, and tiling option

Cite As

Kesh Ikuma (2023). inputsdlg: Enhanced Input Dialog Box (https://www.mathworks.com/matlabcentral/fileexchange/25862-inputsdlg-enhanced-input-dialog-box), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2014a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
2.3.2.0

Bug fix on list control's default value processing

2.3.1.0

Bug fixes in default value processing

2.3.0.0

- Allows a row vector with edit:vector format.
- Bug fixes in edit:vector processing

2.2.0.0

* Added support for 'text' format with 'check' type
* Added support for custom attribute validation for 'edit' type with 'float', 'integer', and 'vector' formats
* Now uses validateattribute() built-in function
* Bug fixes
Title change

1.23.0.0

v.2.1.2
* Improved check_formats sub-function

1.22.0.0

bug fix & extended compatibility to pre-R2011b

1.21.0.0

v2.1b - same day bug fixes #2

1.20.0.0

v2.1a (same day bug fixes)

1.19.0.0

v.2.1.0 (Jul 03, 2014)
* Added support for 'none' Format type as a placeholder for an empty row or column.
* Removed restriction on Cancel & Apply buttons.
* Bug fixes

1.18.0.0

v2.0.6 - bug fixes
* default type
* text control positioning

1.17.0.0

updated title

1.16.0.0

* Improved error message on FORMATS-PROMPT size mismatch.
* Fixed several bugs relating to neglected ToolTipString support (thanks David v.B!)
* FORMATS.items for Slider style now sets uicontrol's SliderStep property

1.15.0.0

Bug fix: parsing empty callback format field (Thanks David!)

1.14.0.0

v2.0.3: bug fix release

1.13.0.0

Made compatible with pre-R2013a releases

1.12.0.0

Bug fix release

1.11.0.0

v.2.0 (T. Ikuma & F. Hatz)
* Major update with majority of innards rewritten. See version history in the m-file
* Supports 3 additional types: color, table, and button
* Supports custom callbacks

1.10.0.0

v1.3 (by Luke Reisner)
* Several bug fixes
* Improved dialog UI layout
* Other small modifications

1.9.0.0

v1.2.3
* Yet another checkoptions() bug fixes...

1.8.0.0

v.1.2.2 (July 15, 2010)
* Rewritten checkoptions() (to correct issues reported by Jason)
* Bug Fix: file & dir control enable config were interpreted backwards

1.7.0.0

Bug Fix: Default Options bug reported by Jason

1.6.0.0

* Fixed a couple bugs
* Added edit::date format
* Added formats.enable support
* Added options.CancelButton support
* Added options.ButtonNames support

1.5.0.0

(v.1.12) More bug fixes

1.4.0.0

v1.11
More bug fixes (again thanks Andreas!)

1.3.0.0

v1.1 (Nov. 19, 2009)
* Several bug fixes (thanks Andreas!)
* Apply button feature added
* Unit label (to the right of control) feature added

1.0.0.0