Correction: the panels themselves do not do this, only the objects within (panels within panels are an exception as they behave the same as other objects within the outermost panel).
GUI panels moving around upon updating axes
1 view (last 30 days)
Show older comments
I am writing a GUI based program that has several panels and one set of axes. As the primary calculation function runs, the axes are updated to show the physical state of the system (using plot > drawnow). The problem is, each time the axes are updated, all of the panels and objects nested within them scale in size, shift a bit, then shift back to the correct position and size shortly after. Since the axes are updated 50 times per execution, this is pretty irritating and I'd like to find a solution.
3 Comments
Walter Roberson
on 23 May 2017
Odd... what is your figure Renderer set to? There is the possibility that getframe might switch Renderer temporarily, and that could lead to changes in output.
Answers (1)
Walter Roberson
on 17 May 2017
I think you might be encountering a SizeChangedFcn . Perhaps a ResizeFcn, but that seems less likely to me. See some hints:
and see
If you have multiple property changes, sometimes the way to deal with the situation is to make the object (or container) visible off, make the several changes, and then set visible on again.
My work on HG1 showed that unless you did a drawnow() or pause(), it was common for the old appearance (with the object still visible) to persist for long enough that the changes to effectively happen as a batch, everything updating at once -- just as one might hope would happen. But this was not something that could be counted on: if you did "enough" computation before making the object visible again, then it would update "by itself".
Another way of putting this is that using drawnow() or pause() to flush the event queue would typically (but not always) trigger an update that would have the object go invisible while you were working on it, but that if you do not signal that you want the event queue flushed, then typically the graphics would not update until you so signaled. But this is not foolproof: the event queue can end up getting acted upon even outside of the conditions specifically defined as giving an opportunity for it to be paid attention to.
See Also
Categories
Find more on Graphics Performance 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!