acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
tabview.md (2194B)
1 ```eval_rst 2 .. include:: /header.rst 3 :github_url: |github_link_base|/widgets/extra/tabview.md 4 ``` 5 6 # Tabview (lv_tabview) 7 8 ## Overview 9 10 The Tab view object can be used to organize content in tabs. 11 The Tab view is built from other widgets: 12 - Main container: [lv_obj](/widgets/obj)) 13 - Tab buttons: [lv_btnmatrix](/widgets/core/btnmatrix) 14 - Container for the tabs: [lv_obj](/widgets/obj) 15 - Content of the tabs: [lv_obj](/widgets/obj) 16 17 The tab buttons can be positioned on the top, bottom, left and right side of the Tab view. 18 19 A new tab can be selected either by clicking on a tab button or by sliding horizontally on the content. 20 21 ## Parts and Styles 22 There are no special parts on the Tab view but the `lv_obj` and `lv_btnnmatrix` widgets are used to create the Tab view. 23 24 ## Usage 25 26 ### Create a Tab view 27 28 `lv_tabview_create(parent, tab_pos, tab_size);` creates a new empty Tab view. `tab_pos` can be `LV_DIR_TOP/BOTTOM/LEFT/RIGHT` to position the tab buttons to a side. 29 `tab_size` is the height (in case of `LV_DIR_TOP/BOTTOM`) or width (in case of `LV_DIR_LEFT/RIGHT`) tab buttons. 30 31 ### Add tabs 32 33 New tabs can be added with `lv_tabview_add_tab(tabview, "Tab name")`. This will return a pointer to an [lv_obj](/widgets/obj) object where the tab's content can be created. 34 35 ### Change tab 36 37 To select a new tab you can: 38 - Click on its tab button 39 - Slide horizontally 40 - Use `lv_tabview_set_act(tabview, id, LV_ANIM_ON/OFF)` function 41 42 ### Get the parts 43 44 `lv_tabview_get_content(tabview)` returns the container for the tabs, `lv_tabview_get_tab_btns(tabview)` returns the Tab buttons object which is a [Button matrix](/widgets/core/btnmatrix). 45 46 ## Events 47 - `LV_EVENT_VALUE_CHANGED` Sent when a new tab is selected by sliding or clicking the tab button. `lv_tabview_get_tab_act(tabview)` returns the zero based index of the current tab. 48 49 Learn more about [Events](/overview/event). 50 51 ## Keys 52 53 Keys have effect only on the tab buttons (Button matrix). Add manually to a group if required. 54 55 Learn more about [Keys](/overview/indev). 56 57 ## Example 58 59 ```eval_rst 60 61 .. include:: ../../../examples/widgets/tabview/index.rst 62 63 ``` 64 65 ## API 66 67 ```eval_rst 68 69 .. doxygenfile:: lv_tabview.h 70 :project: lvgl 71 72 ```