mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-21 22:52:46 +08:00
docs: fixed several problems...
- code-block in nuttx.rst was generating errors because the default parser did not know what language it was. Now the Kconfig parser parses it and it looks nice now. - The new table in cmake.rst was not showing up at all because it was not formatted correctly. - The new list in https://docs.lvgl.io/master/details/common-widget-features/basics.html#setting-names was being formatted as a paragraph instead of a list. - Several minor grammar corrections for clarity.
This commit is contained in:
committed by
Gabor Kiss-Vamosi
parent
6f26b71d95
commit
4533d2918a
@@ -132,7 +132,6 @@ of children. There is no limitation for the type of the parent but there are Wi
|
||||
which are typically a parent (e.g. button) or a child (e.g. label).
|
||||
|
||||
|
||||
|
||||
Moving together
|
||||
---------------
|
||||
|
||||
@@ -160,6 +159,7 @@ Modify the position of the parent:
|
||||
(For simplicity the adjusting of colors of the Widgets is not shown in
|
||||
the example.)
|
||||
|
||||
|
||||
Visibility only on the parent
|
||||
-----------------------------
|
||||
|
||||
@@ -173,8 +173,8 @@ outside will not be visible.
|
||||
lv_obj_set_x(widget1, -30); /* Move the child a little bit off the parent */
|
||||
|
||||
This behavior can be overwritten with
|
||||
:cpp:expr:`lv_obj_add_flag(widget, LV_OBJ_FLAG_OVERFLOW_VISIBLE)` which allow the
|
||||
children to be drawn out of the parent. In addition to this, you must register
|
||||
:cpp:expr:`lv_obj_add_flag(widget, LV_OBJ_FLAG_OVERFLOW_VISIBLE)` which allows the
|
||||
children to be drawn outside of the parent. In addition to this, you must register
|
||||
the following event callback (this was not required in previous versions).
|
||||
|
||||
Note: ``ext_width`` should be the maximum absolute width the children will be
|
||||
@@ -184,9 +184,10 @@ drawn within.
|
||||
|
||||
static void ext_draw_size_event_cb(lv_event_t * e)
|
||||
{
|
||||
lv_event_set_ext_draw_size(e, 30); /*Set 30px extra draw area around the widget*/
|
||||
lv_event_set_ext_draw_size(e, 30); /* Set 30px extra draw area around the widget */
|
||||
}
|
||||
|
||||
|
||||
Creating and deleting Widgets
|
||||
-----------------------------
|
||||
|
||||
@@ -577,6 +578,8 @@ more on encoder behaviors and the edit mode.
|
||||
|
||||
Learn more about :ref:`indev_keys`.
|
||||
|
||||
|
||||
|
||||
.. _widget_names:
|
||||
|
||||
Names
|
||||
@@ -590,6 +593,7 @@ as a function parameter or made a global variable. However, this approach has so
|
||||
- It's not scalable. Passing references to 20 widgets as function parameters is not ideal.
|
||||
- It's hard to track whether a widget still exists or has been deleted.
|
||||
|
||||
|
||||
Setting names
|
||||
-------------
|
||||
|
||||
@@ -605,14 +609,18 @@ If a name ends with ``#``, LVGL will automatically replace it with an index base
|
||||
number of siblings with the same base name. If no name is provided, the default is
|
||||
``<widget_type>_#``.
|
||||
|
||||
Below is an example showing how manually and automatically assigned names are resolved:
|
||||
Below is an example showing how manually- and automatically-assigned names are resolved:
|
||||
|
||||
- Main ``lv_obj`` container named ``"cont"``: "cont"
|
||||
|
||||
- ``lv_obj`` container named ``"header"``: "header"
|
||||
|
||||
- ``lv_label`` with no name: "lv_label_0"
|
||||
- ``lv_label`` named ``"title"``: "title"
|
||||
- ``lv_label`` with no name: "lv_label_1" (It's the third label, but custom-named widgets are not counted)
|
||||
|
||||
- ``lv_obj`` container named ``"buttons"``:
|
||||
|
||||
- ``lv_button`` with no name: "lv_button_0"
|
||||
- ``lv_button`` named ``"second_button"``: "second_button"
|
||||
- ``lv_button`` with no name: "lv_button_1"
|
||||
@@ -623,21 +631,22 @@ Below is an example showing how manually and automatically assigned names are re
|
||||
- ``lv_button`` named ``mybtn_#``: "mybtn_2"
|
||||
- ``lv_button`` named ``mybtn_#``: "mybtn_3"
|
||||
|
||||
|
||||
Finding widgets
|
||||
---------------
|
||||
|
||||
Widgets can be found by name in two ways:
|
||||
|
||||
1. **Get a direct child by name** using :cpp:func:`lv_obj_get_child_by_name(parent, "child_name")`.
|
||||
1. **Get a direct child by name** using :cpp:expr:`lv_obj_get_child_by_name(parent, "child_name")`.
|
||||
Example:
|
||||
``lv_obj_get_child_by_name(header, "title")``
|
||||
:cpp:expr:`lv_obj_get_child_by_name(header, "title")`
|
||||
You can also use a "path" to find nested children:
|
||||
``lv_obj_get_child_by_name(cont, "buttons/mybtn_2")``
|
||||
:cpp:expr:`lv_obj_get_child_by_name(cont, "buttons/mybtn_2")`
|
||||
|
||||
2. **Find a descendant at any level** using :cpp:func:`lv_obj_find_by_name(parent, "child_name")`.
|
||||
2. **Find a descendant at any level** using :cpp:expr:`lv_obj_find_by_name(parent, "child_name")`.
|
||||
Example:
|
||||
``lv_obj_find_by_name(cont, "mybtn_1")``
|
||||
Note that ``"mybtn_1"`` is a child of ``"buttons"``, not directly of ``"cont"``.
|
||||
:cpp:expr:`lv_obj_find_by_name(cont, "mybtn_1")`
|
||||
Note that ``"mybtn_1"`` is a child of ``buttons``, not a direct child of ``cont``.
|
||||
This is useful when you want to ignore hierarchy and search by name alone.
|
||||
|
||||
Since both functions start searching from a specific parent, it’s possible to have multiple widget
|
||||
@@ -659,6 +668,8 @@ Names are resolved **when they are retrieved**, not when they are set.
|
||||
This means the indices always reflect the current state of the widget tree
|
||||
at the time the name is used.
|
||||
|
||||
|
||||
|
||||
.. _widget_snapshot:
|
||||
|
||||
Snapshot
|
||||
@@ -680,3 +691,7 @@ Example
|
||||
|
||||
API
|
||||
***
|
||||
|
||||
.. API equals: lv_screen_load
|
||||
|
||||
.. API startswith: lv_obj_
|
||||
|
||||
@@ -175,7 +175,7 @@ Below is a list of the available options/variables
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
:widths: 30 70
|
||||
:widths: 20 10 50
|
||||
|
||||
* - Variable/Option
|
||||
- Type
|
||||
@@ -209,18 +209,18 @@ Below is a list of the available options/variables
|
||||
``CONFIG_LV_BUILD_*`` CMake variables based on the contents of ``lv_conf_internal.h``.
|
||||
This requires python3 with ``venv`` and ``pip`` or access to a working ``pcpp``.
|
||||
If KConfig is used, this is enabled automatically.
|
||||
* - CONFIG_LV_BUILD_DEMOS
|
||||
- BOOLEAN
|
||||
- When enabled builds the demos
|
||||
* - CONFIG_LV_BUILD_EXAMPLES
|
||||
- BOOLEAN
|
||||
- When enabled builds the examples
|
||||
* - CONFIG_LV_USE_THORVG_INTERNAL
|
||||
- BOOLEAN
|
||||
- When enabled the in-tree LVGL version of ThorVG is compiled
|
||||
* - CONFIG_LV_USE_PRIVATE_API
|
||||
- BOOLEAN
|
||||
- When enabled the private headers ``*_private.h`` are installed on the system
|
||||
* - CONFIG_LV_BUILD_DEMOS
|
||||
- BOOLEAN
|
||||
- When enabled builds the demos
|
||||
* - CONFIG_LV_BUILD_EXAMPLES
|
||||
- BOOLEAN
|
||||
- When enabled builds the examples
|
||||
* - CONFIG_LV_USE_THORVG_INTERNAL
|
||||
- BOOLEAN
|
||||
- When enabled the in-tree LVGL version of ThorVG is compiled
|
||||
* - CONFIG_LV_USE_PRIVATE_API
|
||||
- BOOLEAN
|
||||
- When enabled the private headers ``*_private.h`` are installed on the system
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
=============
|
||||
Build systems
|
||||
Build Systems
|
||||
=============
|
||||
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ the middle of ``apps/graphics/lvgl/Kconfig``. See the "PASTE THE CONTENTS ..." s
|
||||
|
||||
``apps/graphics/lvgl/Kconfig``:
|
||||
|
||||
.. code-block::
|
||||
.. code-block:: kconfig
|
||||
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
|
||||
Reference in New Issue
Block a user