Figure steals focus from parent app on update
2 views (last 30 days)
Show older comments
Hi,
I have an app from which the user can run analysis functions which create some plots in new figure windows. These plots update during the analysis via changing the handle properties of the graphics objects.
My issue is that every time the figure updates it steals focus from the app. If you're working in another program entirely, it won't steal focus from that, but it will steal focus from any window which is part of the same Matlab session the app is running from.
This is a problem because I want the user to be able to still use the app (e.g. to pause the analysis) whilst the analysis is running, and it is irritating if the focus is lost whilst you're about to click a button, or if you're dragging the window to a different location on the screen.
I've seen one proposed solution to similar questions is to set the figure handle visibility to false. This is problematic for me, because I'm saving the figures to files, and if you save an figure with visibility=false, it will be still invisible still when you load it.
Can anyone suggest any solutions or workarounds for the above? Many thanks
0 Comments
Answers (1)
Image Analyst
on 9 Aug 2022
It's been a problem for years. It doesn't always seem to happen but when it does it's very annoying. I remember one time it wasn't happening but if I stopped at a breakpoint, then it would happen always after that.
The only workaround I know of is to have a "display" flag that you set in advance to not do any display/imaging/graphing functions.
Maybe search the forum for "steal focus" for prior discussions.
See Also
Categories
Find more on Graphics Object Properties 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!