How to make a modal window generated during openingFcn on top of the GUIDE window

1 Ansicht (letzte 30 Tage)
I have a logic to check something when a GUIDE window opens (in openingFcn) and if the check fails, display a warning modal window (warndlg). The GUIDE window is also a modal window. The problem is that since the openingFcn is called before the GUIDE window shows up and as a result the warning modal window shows up first, it will be behind the GUIDE window. A user has to move the GUIDE window around or close the GUIDE window to see the warning message, which defeats the purpose of a warning. Is there a callback for events such as window_opened in Matlab?

Akzeptierte Antwort

Greg
Greg am 19 Jun. 2018
Bearbeitet: Greg am 19 Jun. 2018
Use uiwait.
h = warndlg(. . .);
uiwait(h);
%%%These commands won't execute until warndlg is closed
%%%I.e., your GUIDE figure won't show up to block the warning
Using uiwait comes with other problems ( all of MATLAB is blocked until the warndlg is closed). I won't preach App Designer vs. GUIDE, but App Designer has solved these kinds of limitations with options such as uialert and uiconfirm.

Weitere Antworten (0)

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange

Produkte


Version

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by