Rendering problem with axes in nested uipanels
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
I'm encountering a problem with uipanel and graphics objects inside it. Basically, I have a gui with one main uipanel, and a number of smaller uipanels that are children of this "super"-panel. Each of the small panels contains a few buttons and an axes object with an image in it. I then want to move the superpanel and all its children programmatically (the aim is to use a slider to scroll through it, but that is not really important). However, when I do that, the axes object does not move properly. It stays in the spot where it was last drawn (e.g. after drawnow or a pause in the program). How can I fix this behaviour? Solutions I've tried so far:
i) using just one panel instead of two nested panels. This seems to solve the problem, everything is drawn correctly, but this is not practical in my program.
ii) using different renderer's. This seems to make the problem worse; all sorts of other clipping problems occur.
iii) Calling drawnow does not help.
iv) Saving the figure or calling print resolves the problem. If I step through print, I can see that the call that resolves the problem is
line 276 pj = render(pj,pj.Handles{i});
However, I can't call the private function render from outside (and this doesn't seem like a very elegant or practical solution). Is there any other way I can force a rendering update?
Any help would be appreciated. Sample code to reproduce the problem and a screenshot of the result can be found below.
Thanks!
P.S.: I'm working in 2014a on Windows 7
I = imread('ngc6543a.jpg'); %read image
fh = figure(1); %create figure
clf;
sp = uipanel('parent', fh, 'position', [.2 .3 .4 .4]); %create superpanel
ph = uipanel('parent', sp, 'position', [.1 .1 .8 .8]); %create sub-panel
ah = axes('parent', ph, 'position', [0 0 1 1]); %create axes object
image(I, 'parent', ah); %draw image
drawnow
set(sp, 'position', [.1 .1 .4 .4]) %move superpanel
1 comentario
Respuestas (1)
Thomas
el 1 de Dic. de 2015
I ran into the same issue in 2012b (axes in nested panel doesn't move with parent), while trying to make backward compatible a programmatic GUI that works fine in 2015a. What a brain buster! Knowing that this issue is still unresolved, I guess I'll just have to ask them to upgrade... Moving forward it would be nice if sliders could be inserted automatically as an option (for parent figures, tabs, panels) when object positions extend beyond their parents.
0 comentarios
Ver también
Categorías
Más información sobre Graphics Performance en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!