How do I make a waitbar that is always on top of other windows?

4 views (last 30 days)
I have a waitbar that measures the progress of a script. However, the script causes other graphics objects to update, which brings them to the foreground and obscures the waitbar. Is there a way to ensure that it is always on top?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 11 Mar 2021
Edited: MathWorks Support Team on 11 Mar 2021
Please try to change 'WindowStyle' property of the waitbar Figure to 'modal'.
h=waitbar(0,'test','windowstyle', 'modal');
Also, you may be able to use some functionality provided by Java to accomplish this. Check out the solution available at the following MATLAB Central link:
Most importantly, the code necessary to set the waitbar to "always on top" is as follows:
h=waitbar(0,'test','windowstyle', 'modal');
frames = java.awt.Frame.getFrames();
frames(end).setAlwaysOnTop(1);

More Answers (0)

Categories

Find more on App Building in Help Center and File Exchange

Tags

No tags entered yet.

Products


Release

R2015a

Community Treasure Hunt

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

Start Hunting!