主要内容

uitab.

创建选项卡式面板

描述

t = uitab在选项卡组中创建一个选项卡并返回标签目的。如果没有标签组,Matlab®calls the数字function to create a figure. Then it creates a tab group in that figure, and places the tab inside the tab group.

t = uitab(姓名,Value)specifies tab property values using one or more name-value pair arguments.

t = uitab()creates the tab in the specified parent container. The parent container can be a tab group in a figure created with either the数字要么Uifigure.功能。财产价值uitab.vary slightly depending on whether the app is created with the数字要么Uifigure.功能。For more information, see姓名-Value Pair Arguments

example

t = uitab(,姓名,Value)指定父容器和一个或多个属性值。

例子

collapse all

Create a figure containing a tab group and two tabs.

f = figure; tabgp = uitabgroup(f,'Position',[.05 .05 .3 .8]); tab1 = uitab(tabgp,“标题”,'设置');tab2 = uitab(tabgp,“标题”,'选项');

Get the title of the first tab.

tab1.Title
ans = Settings

The可滚动属性使能滚动具有其边界外部的组件的选项卡中。只有在父选项卡组在创建的图形中时才可能滚动Uifigure.功能。App Designer uses this type of figure for creating apps.

Create a tab group containing one tab. Add six UI components to the tab, with the first three lying outside the upper border of the tab.

fig = uifigure; tg = uitabgroup(fig,'Position',[20 20 196 145]); t = uitab(tg,“标题”,'Member Information');ef1 = uieditfield(t,'文本','Position',[11 165 140 22],'Value','名');ef2 = Uieditfield(T,'文本','Position',[11 140 140 22],'Value','Last Name');ef3 = Uieditfield(T,'文本','Position',[11 115 140 22],'Value','地址');dd = uidropdown (t)'Position',[11 90 140 22],'Items',{'Male','Female'});cb = uicheckbox(t,'Position',[11 65 140 22],'Text','成员');B = UIBUTTON(T,'Position',[11 40 140 22],'Text','发送');

通过设置滚动滚动可滚动property of the tab to'on'。默认情况下,滚动框显示在顶部。

t.Scrollable ='on';

Input Arguments

collapse all

父容器, specified as a tab group. The tab group can be a child of a figure created with either the数字要么Uifigure.功能。

姓名-Value Arguments

例子:uitab('title','选项')指定选项卡标题是选项

Specify optional comma-separated pairs of姓名,Value论点。姓名is the argument name and价值是相应的价值。姓名必须出现在单引号内(''). You can specify several name and value pair arguments as姓名1,Value1,...,NameN,ValueN

Note

此处列出的属性是可用属性的子集。对于完整列表,请参阅标签特性

标题,指定为字符向量,字符串标量或分类数组。如果将此属性指定为分类数组,则MATLAB仅显示数组中的第一个元素。

MATLAB不会解释垂直斜杠('|') character as a line break, it displays as a vertical slash in the title.

如果要指定Unicode®字符,将Unicode十进制代码传递给char功能。For example,['Multiples of ' char(960)]displays as乘iples ofπ

背景颜色, specified as an RGB triplet, a hexadecimal color code, or one of the color options listed in the table.

RGB三元组和十六进制颜色代码对于指定自定义颜色很有用。

  • An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range[0,1];例如,[0.4 0.6 0.7]

  • 十六进制颜色代码是字符向量或以哈希符号开头的字符串标量(#)接着是三个或六个十六进制数字,可以从0F。值不区分大小写。因此,颜色代码'#ff8800','#ff8800','#F80', and'#f80'are equivalent.

Alternatively, you can specify some common colors by name. This table lists the named color options, the equivalent RGB triplets, and hexadecimal color codes.

Color Name 简称 RGB Triplet Hexadecimal Color Code Appearance
“红色” 'r' [1 0 0] '#FF0000'

Sample of the color red

'green' 'G' [0 1 0] '#00FF00'

颜色的样本

'蓝色' 'B' [0 0 1] '#0000FF'

Sample of the color blue

'cyan' 'C' [0 1 1] '#00ffff'

青色样本

'magenta' “米” [1 0 1] '#ff00ff'

Sample of the color magenta

'黄色的' 'y' [1 1 0] '#FFFF00'

颜色的样本

'黑色的' 'k' [0 0 0] '#000000'

黑色样本

'white' 'w' [1 1 1] '#FFFFFF'

Sample of the color white

以下是RGB三元组和用于默认颜色MATLAB在许多类型的图中使用的默认颜色的十六进制颜色代码。

RGB Triplet Hexadecimal Color Code Appearance
[0 0.4470 0.7410] '#0072bd'

RGB三联体的样品[0 0.4470 0.7410],它看起来深蓝色

[0.8500 0.3250 0.0980] '#D95319'

RGB三联样品样品[0.8500 0.3250 0.0980],它显示为深橙色

[0.9290 0.6940 0.1250] '#EDB120'

RGB三态的样品[0.9290 0.6940 0.1250],它看起来深黄色

[0.4940 0.1840 0.5560] '#7E2F8E'

Sample of RGB triplet [0.4940 0.1840 0.5560], which appears as dark purple

[0.4660 0.6740 0.1880] '#77AC30'

Sample of RGB triplet [0.4660 0.6740 0.1880], which appears as medium green

[0.3010 0.7450 0.9330] “# 4 dbeee”

RGB三重蛋白样品[0.3010 0.7450 0.9330],它看起来像浅蓝色

[0.6350 0.0780 0.1840] '#A2142F'

RGB三重蛋白样品[0.6350 0.0780 0.1840],它显示为深红色

此属性是只读的。

选项卡的位置和大小,作为表单的四元素向量返回[左下宽度]。This table describes each element in the vector.

元素 描述
left 距离选项卡组内左边缘的距离组到选项卡的内部左边缘
底部 Distance from the inner bottom edge of the tab group to the inner bottom edge of the tab
宽度 选项卡右侧和左下内边缘之间的距离
高度 Distance between the top and bottom inner edges of the tab

All measurements are in units specified by the单位property.

Note

这些是在使用时考虑的一些重要观点Position财产:

  • Position值受标签标题的长度的影响标签Locationproperty of the parent标签Group目的。

  • Position值相对于drawable area父母标签Group,这是其边界内的区域。

  • If the tab is in a grid layout manager, the value of thePositionproperty is not immediately updated. To use thePosition要调整选项卡子项相对于标签大小的值,请使用aSizechangedFCN.callback.

测量单位, specified as one of the values in this table.

单位价值 描述
'pixels'(默认)

像素的距离与Windows上的系统分辨率无关®Macintosh.systems:

  • 在Windows systems, a pixel is 1/96th of an inch.

  • Macintosh.系统,像素是1/72nd的英寸。

在Linux上®systems, the size of a pixel is determined by your system resolution.

'normalized'

These units are normalized with respect to the parent container. The lower-left corner of the container maps to(0,0)和右上角地图(1,1)

'英寸' 英寸。
'厘米' Centimeters.
“点” Points. One point equals 1/72nd of an inch.

The recommended value is'pixels',因为大多数MATLAB应用程序构建功能测量像素的距离。

数字-Based Apps

For tabs in apps created using the数字function, the default value of单位is'normalized'

此外,您可以指定单位as'characters'。字符单元基于图形根对象的默认UIControl字体:

  • 字符宽度=字母的宽度x

  • 字符高度=两行文本的基线之间的距离。

To access the default uicontrol font, useget(groot,'defaultuicontrolFontName')要么set(groot,'defaultuicontrolfontname')

版本sion History

介绍在R2014B.

See Also

Functions

特性