Reputation: 1346
I have a Matlab GUIDE figure with nested panels. I also have control objects on top of the panels. Here's a notional example:
In order to align all of the checkboxes, they all need to be in the same control group. I want to move the checkboxes so that their parent is the main panel rather than one of the sub-panels. The sub-panels are just there for visual grouping and don't really have a functional value.
The object browser shows the relationships, but I see no way to change it. I've tried pasting the objects I want to move outside the sub-panel and dragging them back in, but they automatically get added to the sub-panel. If I paste outside of the sub-panel I can use the arrow keys to move them back in and the parent will stay the main panel, but that gets to be tedious.
How can I change the parent panel of a GUIDE control object?
Upvotes: 1
Views: 1263
Reputation: 5190
Building the GUI with guide
a possible solution could be:
uipanel
checkbox
in the main `uipanel'Align Objects
tool on the guide toolbaruipanel
over some of the checkbox
. It will cover the `checkbox'uipanel
Send to Back
optionIf you want to create the GUI "programmatically" you can:
figure
Style
property to checkbox
and the position
property so that they will be placed in the main paneluipanel
will mask the checkbox
Thsi is a possible implementation
% Create the figure
figure
% Add the Main uipanel
p1=uipanel('units','normalized','position',[.1 .1 .5 .7],'title','Main Panel')
% Add come checkboxes
cb1=uicontrol('parent',p1,'style','checkbox','units','normalized', ...
'position',[.1 .7 .3 .1],'string','checkbox 1')
cb2=uicontrol('parent',p1,'style','checkbox','units','normalized', ...
'position',[.1 .6 .3 .1],'string','checkbox 2')
cb3=uicontrol('parent',p1,'style','checkbox','units','normalized', ...
'position',[.1 .5 .3 .1],'string','checkbox 3')
% Add the Secondary uipanel
p2=uipanel('parent',p1,'units','normalized','position',[.05 .4 .4 .5], ...
'title','Secondary Panel')
% Push the secondary uipanel back
uistack(p2,'bottom')
Hope this helps.
Qapla'
Upvotes: 1