Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

uipanel - Create panel container object

Syntax

h = uipanel('PropertyName1',value1,'PropertyName2',value2,...)
h = uipanel(parent,'PropertyName1',value1,'PropertyName2',value2,...)

Description

A uipanel groups components. It can contain user interface controls with which the user interacts directly. It can also contain axes, other uipanels, and uibuttongroups. It cannot contain ActiveX controls.

h = uipanel('PropertyName1',value1,'PropertyName2',value2,...) creates a uipanel container object in a figure, uipanel, or uibuttongroup. Use the Parent property to specify the parent figure, uipanel, or uibuttongroup. If you do not specify a parent, uipanel adds the panel to the current figure. If no figure exists, one is created. See the Uipanel Properties reference page for more information.

h = uipanel(parent,'PropertyName1',value1,'PropertyName2',value2,...) creates a uipanel in the object specified by the handle, parent. If you also specify a different value for the Parent property, the value of the Parent property takes precedence. parent must be a figure, uipanel, or uibuttongroup.

A uipanel object can have axes, uicontrol, uipanel, and uibuttongroup objects as children. For the children of a uipanel, the Position property is interpreted relative to the uipanel. If you move the panel, the children automatically move with it and maintain their positions relative to the panel.

After creating a uipanel object, you can set and query its property values using set and get.

Remarks

If you set the Visible property of a uipanel object to 'off', any child objects it contains (buttons, button groups, axes, etc.) become invisible along with the panel itself. However, doing this does not affect the settings of the Visible property of any of its child objects, even though all of them remain invisible until the uipanel's visibility is set to 'on'. uibuttongroup components also behave in this manner.

Examples

This example creates a uipanel in a figure, then creates a subpanel in the first panel. Finally, it adds a pushbutton to the subpanel. Both panels use the default Units property value, normalized. Note that default Units for the uicontrol pushbutton is pixels.

h = figure;
hp = uipanel('Title','Main Panel','FontSize',12,...
             'BackgroundColor','white',...
             'Position',[.25 .1 .67 .67]);
hsp = uipanel('Parent',hp,'Title','Subpanel','FontSize',12,...
              'Position',[.4 .1 .5 .5]);
hbsp = uicontrol('Parent',hsp,'String','Push here',...
              'Position',[18 18 72 36]);

See Also

hgtransform, uibuttongroup, uicontrol

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS