Why does overlapping panels in GUIDE seem to lock their 'visible' property in MATLAB 7.9 (R2009b)?
3 views (last 30 days)
Show older comments
MathWorks Support Team
on 6 Apr 2011
Edited: MathWorks Support Team
on 4 Oct 2019
I lay out a GUI with GUIDE and I want to overlap two button group panels, because I don't have enough space to have them separately. I then want to toggle between them by setting only one to be visible at a time.
However, I find that if I set the 'visible' property to 'off' the other also disappears, despite the other having 'visible' set to 'on'.
Accepted Answer
MathWorks Support Team
on 4 Oct 2019
Edited: MathWorks Support Team
on 4 Oct 2019
GUIDE will make any UI component, which is positioned within or over a panel, a child of that panel. This includes other panels.
Thus, the above behavior is expected because, when a panel's visibility is set to 'off', any components that are a child of that panel should also not be visible.
The solution is to make sure that your panels are all direct children of the figure window, rather than nested within each other. You can do this with additional code in the Opening Function. For example, you could add similar code to this:
% Ensure uipanels are parented by the figure
panel_handles = findobj(handles.figure1,'type','uipanel')
set( panel_handles, 'parent', handles.figure1)
0 Comments
More Answers (0)
See Also
Categories
Find more on Migrate GUIDE Apps 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!