Skip to content

Latest commit

 

History

History
141 lines (94 loc) · 3.77 KB

menu.rst

File metadata and controls

141 lines (94 loc) · 3.77 KB

Menu (lv_menu)

Overview

The menu widget can be used to easily create multi-level menus. It handles the traversal between pages automatically.

Parts and Styles

The menu widget is built from the following objects:

Usage

Create a menu

:cpp:expr:`lv_menu_create(parent)` creates a new empty menu.

Header mode

The following header modes exist:

You can set header modes with :cpp:expr:`lv_menu_set_mode_header(menu, LV_MENU_HEADER...)`.

Root back button mode

The following root back button modes exist:

You can set root back button modes with :cpp:expr:`lv_menu_set_mode_root_back_button(menu, LV_MENU_ROOT_BACK_BTN...)`.

Create a menu page

:cpp:expr:`lv_menu_page_create(menu, title)` creates a new empty menu page. You can add any widgets to the page.

Set a menu page in the main area

Once a menu page has been created, you can set it to the main area with :cpp:expr:`lv_menu_set_page(menu, page)`. NULL to clear main and clear menu history.

Set a menu page in the sidebar

Once a menu page has been created, you can set it to the sidebar with :cpp:expr:`lv_menu_set_sidebar_page(menu, page)`. NULL to clear sidebar.

Linking between menu pages

For instance, you have created a button obj in the main page. When you click the button obj, you want it to open up a new page, use :cpp:expr:`lv_menu_set_load_page_event(menu, obj, new page)`.

Create a menu container, section, separator

The following objects can be created so that it is easier to style the menu:

Events

See the events of the :ref:`Base object <lv_obj>` too.

Learn more about :ref:`events`.

Keys

No keys are handled by the menu widget.

Learn more about :ref:`indev_keys`.

Example

API