This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

uitabgroup

Create container for tabbed panels

Syntax

tg = uitabgroup
tg = uitabgroup(Name,Value)
tg = uitabgroup(parent)
tg = uitabgroup(parent,Name,Value)

Description

tg = uitabgroup creates a tab group in the current figure and returns the TabGroup object. If there is no figure available, MATLAB® calls the figure function to create one. Tab groups are containers for tabs. They allow you to identify the selected tab, and detect when the user selects a different tab.

tg = uitabgroup(Name,Value) specifies tab group property values using one or more name-value pair arguments.

tg = uitabgroup(parent) creates the tab group in the specified parent container. The parent container can be a figure created with either the figure or uifigure function, or a child container such as a panel.

example

tg = uitabgroup(parent,Name,Value) specifies the parent container and one or more properties values.

Examples

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,'Title','settings');
tab2 = uitab(tabgp,'Title','Options');

Get the currently selected tab.

currenttab = tabgp.SelectedTab
currenttab = 

  Tab (settings) with properties:

              Title: 'settings'
    BackgroundColor: [0.9400 0.9400 0.9400]
           Position: [0.0119 0.0089 0.9702 0.9107]
              Units: 'normalized'

The Scrollable property enables scrolling within a tab that has components outside its borders. To use scrolling, the figure must be created with the uifigure function. App Designer uses this type of figure for creating apps.

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

f = uifigure;
tg = uitabgroup(f,'Position',[20 20 196 145]);
t = uitab(tg,'Title','Member Informaion');
ef1 = uieditfield(t,'text','Position',[11 165 140 22],'Value','First Name');
ef2 = uieditfield(t,'text','Position',[11 140 140 22],'Value','Last Name');
ef3 = uieditfield(t,'text','Position',[11 115 140 22],'Value','Addess');
dd = uidropdown(t,'Position',[11 90 140 22],'Items',{'Male','Female'});
cb = uicheckbox(t,'Position',[11 65 140 22],'Text','Member');
b = uibutton(t,'Position',[11 40 140 22],'Text','Send');

Enable scrolling by setting the Scrollable property of the tab to 'on'. By default, the scroll bar displays at the top.

t.Scrollable = 'on';

Input Arguments

collapse all

Parent container, specified as a figure created with either the figure or uifigure function, or a child container:

  • Panels, tabs and button groups can be containers in either type of figure.

  • Grid layouts can be containers only in figures created with the uifigure function.

Name-Value Pair Arguments

Example: 'TabLocation','bottom' specifies that the tab labels are at the bottom of the tab group.

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments as Name1,Value1,...,NameN,ValueN.

  • For a list of properties available for GUIDE, or for creating apps with the figure function, see TabGroup Properties for GUIDE.

  • For a list of properties available for App Designer, or for creating apps with the uifigure function, see TabGroup Properties for App Designer.

See Also

Functions

Properties

Introduced in R2014b