How do I make a waitbar that is always on top of other windows?
4 views (last 30 days)
Show older comments
MathWorks Support Team
on 7 Sep 2015
Edited: MathWorks Support Team
on 11 Mar 2021
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
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);
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!