Skip to content

Latest commit

 

History

History
115 lines (75 loc) · 2.51 KB

tabview.rst

File metadata and controls

115 lines (75 loc) · 2.51 KB

Tabview (lv_tabview)

Overview

The Tab view object can be used to organize content in tabs. The Tab view is built from other widgets:

The tab buttons can be positioned on the top, bottom, left and right side of the Tab view.

A new tab can be selected either by clicking on a tab button or by sliding horizontally on the content.

Parts and Styles

There are no special parts on the Tab view but the lv_obj and lv_button widgets are used to create the Tab view.

Usage

Create a Tab view

:cpp:expr:`lv_tabview_create(parent)` creates a new empty Tab view.

Add tabs

New tabs can be added with :cpp:expr:`lv_tabview_add_tab(tabview, "Tab name")`. This will return a pointer to an :ref:`lv_obj` object where the tab's content can be created.

Rename tabs

A tab can be renamed with :cpp:expr:`lv_tabview_rename_tab(tabview, tab_id, "New Name")`.

Change tab

To select a new tab you can:

Set tab bar position

Using the :cpp:expr:`lv_tabview_set_tab_bar_position(tabview, LV_DIR_LEFT/RIGHT/TOP/BOTTOM)` the tab bar can be moved to any sides.

Set tab bar size

The size of the tab bar can be adjusted by :cpp:expr:`lv_tabview_set_tab_bar_size(tabview, size)` In case of vertical arrangement is means the height of the tab bar, and in horizontal arrangement it means the width.

Get the parts

Events

Learn more about :ref:`events`.

Keys

Keys have effect only on the tab buttons. Add manually to a group if required.

Learn more about :ref:`indev_keys`.

Example

API