Luc 39e06975f2 Update from refactoring branch
### Maintenance page
* Add add tab color for mobile view
* Add spellcheck off / autocorect off in input
* Add disconnect button when authenticate enabled
* Add Invalid user or password message when authentication failed

### Board support
* Add ESP32 S2 support
* Add ESP32 S3 support
* Add ESP32 C3 support

### ESP commands
* Add command 701 to control GCODE streaming
* Remove command 901 as duplicate
* Update command 420 to add more details
* Use text as default output
* All json on all commands for formated output

### Core
* Add benchmak function to check transfer speed (for test only-not production)
* Merge code for ESP3DLib support
* Add better printer display support (M117 / Serial TFT)
* Use ESP32 analogWrite instead of emulated one

### Modules
* Display
	* Refactor code
	* Remove SPI ILI 9341 / 9488 support as not suitable
      * Add ST7789 support (135x240 / 240x240)
* Filesystem
	* Bug fixes due to esp core updates
	* Better SD sharing mecanism
      * Better global FS management
* FTP
	* Add SD sharing support
	* Better global FS management
* GCODE Host
	* Add basic support for macro files
      * Add ESP command support
      * Use not blocking method to stream commands / handle response
* Notifications
	* Add IFTTT notification service
	* Add WebUI notification
	* Add ESP3D display notification
* WebDav
	* Add SD sharing support
	* Add bug fix from https://github.com/d-a-v/ESPWebDAV
	* Better global FS management
* Websocket
	* Add function to handle zombies connections
* WiFi
	* Fix connection to AP sometime fail
	* Fix low signal not diplayed in ESP420 even connected
	* Add AP Setup mode

### Libraries
* Update SDFat-2.0.6 to 2.1.2
* Update ESP32SSDP 1.1.1 to 1.2.0
* Update TFT_eSPI-1.4.11 to 2.4.61
* Update arduinoWebSockets-2.3.5 to 2.3.6
* Update esp8266-oled-ssd1306-4.0.0 to 4.3.0
* Remove lvgl support

### Tools
* Add I2C scanner script
* Add python script to simulate/stress printer serial communication

### PlatformIO
 * Use latest 4.4.0 Espressif32 release (ESP32-arduino core 2.0.3)
 * Add fix for Flash more than 4MB
 * Add Esp32 S2/S3/C3 env
 * Add ESP32-ST7789 / esp32-TTGO_T_Display env
2022-06-01 14:56:57 +08:00

3.3 KiB

.. include:: /header.rst 
:github_url: |github_link_base|/widgets/extra/menu.md

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:

  • Main container: lv_menu_main_cont
    • Main header: lv_menu_main_header_cont
    • Main page: lv_menu_page
  • Sidebar container: lv_menu_sidebar_cont
    • Sidebar header: lv_menu_sidebar_header_cont
    • Sidebar page: lv_menu_page

Usage

Create a menu

lv_menu_create(parent) creates a new empty menu.

Header mode

The following header modes exist:

  • LV_MENU_HEADER_TOP_FIXED Header is positioned at the top.
  • LV_MENU_HEADER_TOP_UNFIXED Header is positioned at the top and can be scrolled out of view.
  • LV_MENU_HEADER_BOTTOM_FIXED Header is positioned at the bottom.

You can set header modes with lv_menu_set_mode_header(menu, LV_MENU_HEADER...).

Root back button mode

The following root back button modes exist:

  • LV_MENU_ROOT_BACK_BTN_DISABLED
  • LV_MENU_ROOT_BACK_BTN_ENABLED

You can set root back button modes with lv_menu_set_mode_root_back_btn(menu, LV_MENU_ROOT_BACK_BTN...).

Create a menu page

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 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 lv_menu_set_sidebar_page(menu, page). NULL to clear sidebar.

Linking between menu pages

For instance, you have created a btn obj in the main page. When you click the btn obj, you want it to open up a new page, use 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:

lv_menu_cont_create(parent page) creates a new empty container.

lv_menu_section_create(parent page) creates a new empty section.

lv_menu_separator_create(parent page) creates a separator.

Events

  • LV_EVENT_VALUE_CHANGED Sent when a page is shown.
    • lv_menu_get_cur_main_page(menu) returns a pointer to menu page that is currently displayed in main.
    • lv_menu_get_cur_sidebar_page(menu) returns a pointer to menu page that is currently displayed in sidebar.
  • LV_EVENT_CLICKED Sent when a back btn in a header from either main or sidebar is clicked. LV_OBJ_FLAG_EVENT_BUBBLE is enabled on the buttons so you can add events to the menu itself.
    • lv_menu_back_btn_is_root(menu, btn) to check if btn is root back btn

See the events of the Base object too.

Learn more about Events.

Keys

No keys are handled by the menu widget.

Learn more about Keys.

Example

.. include:: ../../../examples/widgets/menu/index.rst

API

.. doxygenfile:: lv_menu.h
  :project: lvgl