| MATLAB Function Reference | ![]() |
Syntax
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
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.
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.
Properties
This table lists all properties useful to uipanel objects, grouping them by function. Each property name acts as a link to a description of the property. Curly braces denote the default value, if any
| Property Name |
Description |
Property Value |
| Controlling Style and Appearance | ||
BackgroundColor |
Color of the uipanel background |
ColorSpec. Default is the same as the default uicontrol background. |
BorderType |
Type of border around the uipanel area. |
[none|{etchedin} |
BorderWidth |
Width of the panel border. |
Integer. Default is 1. |
Clipping |
Clipping of child axes, uipanels, and uibuttongroups to the uipanel. Does not affect child uicontrols. |
[{on}|off] |
ForegroundColor |
Title font color and/or color of 2-D border line |
ColorSpec. Default is [0 0 0] (black). |
HighlightColor |
3-D frame highlight color |
ColorSpec. Default is [1 1 1] (white). |
SelectionHighlight |
Object highlighted when selected |
[{on}|off] |
ShadowColor |
3-D frame shadow color |
ColorSpec. Default is [.5 .5 .5] (grey). |
Visible |
Uipanel visibility. Note: Controls the Visible property of child axes, uibuttongroups. and uipanels. Does not affect child uicontrols. |
[{on}|off] |
| General Information About the Object | ||
Children |
All children of the uipanel |
Vector of handles |
Parent |
Uipanel object's parent |
Figure, uipanel, or uibuttongroup handle |
Selected |
Whether object is selected |
[on|{off}] |
Tag |
User-specified object identifier |
String |
UserData |
User-specified data |
Matrix |
| Controlling the Object Position | ||
Position |
Panel position relative to parent figure, uipanel, or uibuttongroup |
Position spec [x y w h]. Default is [0 0 1 1] |
Units |
Units usd to interpret the position vector |
[inches|centimeters |
| Controlling Fonts and Labels | ||
FontAngle |
Title font angle |
[{normal}|italic |
FontName |
Title font name |
String. Default is system dependent. |
FontSize |
Title font size |
Integer. Default is system dependent. |
FontUnits |
Title font units |
[inches|centimeters |
FontWeight |
Title font weight |
[light|{normal}|demi |
Title |
Title string |
String |
TitlePosition |
Location of title string in relation to the panel |
[{lefttop}|centertop |
| Controlling Callback Routine Execution | ||
BusyAction |
Interruption of other callback routines |
[{queue}|cancel] |
ButtonDownFcn |
Button-press callback routine |
String or function handle |
CreateFcn |
Callback routine executed during object creation |
String or function handle |
DeleteFcn |
Callback routine executed during object deletion |
String or function handle |
Interruptible |
Callback routine interruption mode |
[{on}|off] |
ResizeFcn |
User-specified resize routine |
String or function handle |
UIContextMenu |
Associates a uicontextmenu with the uipanel |
Handle |
| Controlling Access to Objects | ||
HandleVisibility |
Handle accessibility from commandline and GUIs |
[{on}|callback|off] |
HitTest |
Selectable by mouse click |
[{on}|off] |
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
| uiopen | Uipanel Properties | ![]() |
© 1994-2005 The MathWorks, Inc.