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.

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

  


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