uiwait(msgbox("My message") dialog comes up behind the app. User never sees it.
Show older comments
Why does uiwait(msgbox("My message") dialog come up behind the app? My user never sees it so can't click OK. Is there a way to bring it to the front other than uialert() which is a lot more complex to program?
1 Comment
dpb
on 29 Jul 2024
Make it modal should fix it.
Accepted Answer
More Answers (1)
Mario Malic
on 29 Jul 2024
Edited: Mario Malic
on 29 Jul 2024
Hi again,
I don't know if there is a better solution, but here is an example with uialert
Idea is to create a new figure with it, and once the button is pressed the figure will be deleted.
fig = uifigure();
% fig = uifigure("WindowStyle", "modal"); % Maybe this works better
uialert(fig,"File not found.","Invalid File", "CloseFcn", @(src, evt)delete(src));
while ishandle(fig) % wait for figure to be deleted
pause(0.1);
end
% rest of code
In case the figure shows behind the active window, try focus function, or
uifigure(fig);
Cheers
Categories
Find more on Update figure-Based Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!