Versione (18,9 KB) da Jan
Self-terminating modal warning dialog with flashing icon
1,6K download
Aggiornato 29 feb 2016

Visualizza la licenza

Nota dell'editore: This file was selected as MATLAB Central Pick of the Week

A warning dialog is displayed with a flashing exclamation mark. The dialog is
terminated automatically with the default reply, if the user does not press a
button in a specified period of time.
This can be useful e.g. for functions, which are checked with automated tests, because the dialog does not block the execution completely.
Show a warning for 15 seconds, choose 'Cancel' if time has passed:
Opt.Delay = 15;
Opt.Button = {'Cancel', 'Reject', 'Accept'}; % 1st is default
Opt.Interpreter = 'tex';
Opt.Wrap = false;
[Reply, TimeOut] = AutoWarnDlg({'This is a \bfwarning\rm!', 'Accept, reject or cancel?'}, 'Question', Opt)

Features: Move button focus with the keyboard, copy warning message to the clipboard, flashing icon, text wrapping can be controlled, works even when called from a callback with 'Interruptible' property set to 'off'.

Tested under Matlab 7.7, 7.8, 8.6: HG2

Cita come

Jan (2024). AutoWarnDlg (, MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R2015b
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Scopri di più su Scope Variables and Generate Names 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!
Versione Pubblicato Note della release

HG2 supported

2nd output: [TimeOut] is TRUE if the timeout was reached. More options for text wrapping.

03-Aug-2009: Fixed help section/example: The delay is defined by the field [Opt.Delay] and not [Opt.Sec].

Nicer shape of wrapped text.