NBUTTONDLG: A Generic Implementation of QUESTBOXDLG

Versione 1.0.0.0 (5,03 KB) da sco1
Generates an n-button question dialog box
76 download
Aggiornato 12 ott 2022

An expansion over QUESTBOXDLG, which allows up to 3 button selections, NBUTTONDLG(Question, ButtonLabels) creates a modal dialog box that sizes to accomodate a generic number of buttons. The number of buttons is determined by the number of elements in buttonlabels, a 1xn cell array of strings. The name of the button that is pressed is returned as a string in userchoice. NBUTTONDLG will theoretically support an infinite number of buttons. The default parameters are optimized for 4 buttons.
NBUTTONDLG returns the label of the selected button as a character array. If the dialog window is closed without a valid selection the return value is empty.
NBUTTONDLG uses UIWAIT to suspend execution until the user responds.
Example:
UserChoice = nbuttondlg('What is your favorite color?', ...
{'Red', 'Green', 'Blue', 'Yellow'} ...
);
if ~isempty(UserChoice)
fprintf('Your favorite color is %s!\n', UserChoice);
else
fprintf('You have no favorite color :(\n')
end

The Question and ButtonLabel inputs can be followed by parameter/value pairs to specify additional properties of the dialog box. For example, NBUTTONDLG(Question, ButtonLabels, 'DialogTitle', 'This is a Title!') will create a dialog box with the specified Question and ButtonLabels and replace the default figure title with 'This is a Title!'

Cita come

sco1 (2024). NBUTTONDLG: A Generic Implementation of QUESTBOXDLG (https://github.com/StackOverflowMATLABchat/nbuttondlg), GitHub. Recuperato .

Compatibilità della release di MATLAB
Creato con R2009b
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Categorie
Scopri di più su Dialog Boxes in Help Center e MATLAB Answers

Community Treasure Hunt

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

Start Hunting!

Le versioni che utilizzano il ramo predefinito di GitHub non possono essere scaricate

Versione Pubblicato Note della release
1.0.0.0

Update version requirement from R2007a to R2009b due to use of tilde operator in function calls.

Fixed handle graphics compatibility issues requiring R2014b or later. Should now work with MATLAB 2007a and later.

Per visualizzare o segnalare problemi su questo componente aggiuntivo di GitHub, visita GitHub Repository.
Per visualizzare o segnalare problemi su questo componente aggiuntivo di GitHub, visita GitHub Repository.