docs(all) Proofread, fix typos and add clarifications in confusing areas (#2528)

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
This commit is contained in:
Kevin Thibedeau
2021-09-06 04:55:37 -04:00
committed by GitHub
parent 715d580d8c
commit 7d9fe20a0e
36 changed files with 654 additions and 656 deletions

View File

@@ -54,11 +54,11 @@ The API of the widgets is described in their [Documentation](/widgets/index) but
### Parent-child structure
A parent object can be considered as the container of its children. Every object has exactly one parent object (except screens), but a parent can have any number of children.
There is no limitation for the type of the parent but, there are typical parent (e.g. button) and typical child (e.g. label) objects.
There is no limitation for the type of the parent but there are objects which are typically a parent (e.g. button) or a child (e.g. label).
### Moving together
If the position of the parent changes the children will move with the parent.
If the position of a parent changes, the children will move along with it.
Therefore, all positions are relative to the parent.
![](/misc/par_child1.png "Objects are moving together 1")
@@ -83,7 +83,7 @@ lv_obj_set_pos(parent, 50, 50); /*Move the parent. The child will move with it.*
### Visibility only on the parent
If a child is partially or fully out of its parent then the parts outside will not be visible.
If a child is partially or fully outside of its parent then the parts outside will not be visible.
![](/misc/par_child3.png "A graphical object is visible on its parent")
@@ -93,7 +93,7 @@ lv_obj_set_x(obj1, -30); /*Move the child a little bit off the parent*/
### Create and delete objects
In LVGL objects can be created and deleted dynamically in run time. It means only the currently created (existing) objects consume RAM.
In LVGL, objects can be created and deleted dynamically at run time. It means only the currently created (existing) objects consume RAM.
This allows for the creation of a screen just when a button is clicked to open it, and for deletion of screens when a new screen is loaded.
@@ -101,7 +101,7 @@ UIs can be created based on the current environment of the device. For example o
Every widget has its own **create** function with a prototype like this:
```c
lv_obj_t * lv_<widget>_create(lv_obj_t * parent, <other paramaters if any>);
lv_obj_t * lv_<widget>_create(lv_obj_t * parent, <other parameters if any>);
```
Typically, the create functions only have a *parent* parameter telling them on which object to create the new widget.
@@ -116,7 +116,7 @@ void lv_obj_del(lv_obj_t * obj);
```
`lv_obj_del` will delete the object immediately.
If for any reason you can't delete the object immediately you can use `lv_obj_del_async(obj)` that will perform the deletion on the next call of `lv_timer_handler()`.
If for any reason you can't delete the object immediately you can use `lv_obj_del_async(obj)` which will perform the deletion on the next call of `lv_timer_handler()`.
This is useful e.g. if you want to delete the parent of an object in the child's `LV_EVENT_DELETE` handler.
You can remove all the children of an object (but not the object itself) using `lv_obj_clean(obj)`.
@@ -148,8 +148,8 @@ There are two automatically generated layers:
- top layer
- system layer
They are independent of the screens and they will be shown on every screen. The *top layer* is above every object on the screen and the *system layer* is above the *top layer* too.
You can add any pop-up windows to the *top layer* freely. But, the *system layer* is restricted to system-level things (e.g. mouse cursor will be placed here in `lv_indev_set_cursor()`).
They are independent of the screens and they will be shown on every screen. The *top layer* is above every object on the screen and the *system layer* is above the *top layer*.
You can add any pop-up windows to the *top layer* freely. But, the *system layer* is restricted to system-level things (e.g. mouse cursor will be placed there with `lv_indev_set_cursor()`).
The `lv_layer_top()` and `lv_layer_sys()` functions return pointers to the top and system layers respectively.
@@ -158,11 +158,11 @@ Read the [Layer overview](/overview/layer) section to learn more about layers.
#### Load screen with animation
A new screen can be loaded with animation too using `lv_scr_load_anim(scr, transition_type, time, delay, auto_del)`. The following transition types exist:
- `LV_SCR_LOAD_ANIM_NONE`: switch immediately after `delay` milliseconds
- `LV_SCR_LOAD_ANIM_OVER_LEFT/RIGHT/TOP/BOTTOM` move the new screen over the current towards the given direction
- `LV_SCR_LOAD_ANIM_MOVE_LEFT/RIGHT/TOP/BOTTOM` move both the current and new screens towards the given direction
- `LV_SCR_LOAD_ANIM_FADE_ON` fade the new screen over the old screen
A new screen can be loaded with animation by using `lv_scr_load_anim(scr, transition_type, time, delay, auto_del)`. The following transition types exist:
- `LV_SCR_LOAD_ANIM_NONE` Switch immediately after `delay` milliseconds
- `LV_SCR_LOAD_ANIM_OVER_LEFT/RIGHT/TOP/BOTTOM` Move the new screen over the current towards the given direction
- `LV_SCR_LOAD_ANIM_MOVE_LEFT/RIGHT/TOP/BOTTOM` Move both the current and new screens towards the given direction
- `LV_SCR_LOAD_ANIM_FADE_ON` Fade the new screen over the old screen
Setting `auto_del` to `true` will automatically delete the old screen when the animation is finished.
@@ -170,7 +170,7 @@ The new screen will become active (returned by `lv_scr_act()`) when the animatio
### Handling multiple displays
Screens are created on the currently selected *default display*.
The *default display* is the last registered display with `lv_disp_drv_register` or you can explicitly select a new default display using `lv_disp_set_default(disp)`.
The *default display* is the last registered display with `lv_disp_drv_register`. You can also explicitly select a new default display using `lv_disp_set_default(disp)`.
`lv_scr_act()`, `lv_scr_load()` and `lv_scr_load_anim()` operate on the default screen.
@@ -178,22 +178,22 @@ Visit [Multi-display support](/overview/display) to learn more.
## Parts
The widgets are built from multiple parts. For example a [Base object](/widgets/obj) uses the main and scrollbar parts but a [Slider](/widgets/core/slider) uses the main, the indicator and the knob parts.
The widgets are built from multiple parts. For example a [Base object](/widgets/obj) uses the main and scrollbar parts but a [Slider](/widgets/core/slider) uses the main, indicator and knob parts.
Parts are similar to *pseudo-elements* in CSS.
The following predefined parts exist in LVGL:
- `LV_PART_MAIN` A background like rectangle*/``
- `LV_PART_MAIN` A background like rectangle
- `LV_PART_SCROLLBAR` The scrollbar(s)
- `LV_PART_INDICATOR` Indicator, e.g. for slider, bar, switch, or the tick box of the checkbox
- `LV_PART_KNOB` Like a handle to grab to adjust the value*/
- `LV_PART_KNOB` Like a handle to grab to adjust the value
- `LV_PART_SELECTED` Indicate the currently selected option or section
- `LV_PART_ITEMS` Used if the widget has multiple similar elements (e.g. table cells)*/
- `LV_PART_ITEMS` Used if the widget has multiple similar elements (e.g. table cells)
- `LV_PART_TICKS` Ticks on scales e.g. for a chart or meter
- `LV_PART_CURSOR` Mark a specific place e.g. text area's or chart's cursor
- `LV_PART_CUSTOM_FIRST` Custom parts can be added from here.
The main purpose of parts to allow styling the "components" of the widgets.
Therefore, the parts are described in more detail in the [Style overview](/overview/style) section.
The main purpose of parts is to allow styling the "components" of the widgets.
They are described in more detail in the [Style overview](/overview/style) section.
## States
The object can be in a combination of the following states:
@@ -211,7 +211,7 @@ The object can be in a combination of the following states:
- `LV_STATE_USER_3` Custom state
- `LV_STATE_USER_4` Custom state
The states are usually automatically changed by the library as the user presses, releases, focuses, etc. an object.
The states are usually automatically changed by the library as the userinteracts qith an object (presses, releases, focuses, etc.).
However, the states can be changed manually too.
To set or clear given state (but leave the other states untouched) use `lv_obj_add/clear_state(obj, LV_STATE_...)`
In both cases OR-ed state values can be used as well. E.g. `lv_obj_add_state(obj, part, LV_STATE_PRESSED | LV_PRESSED_CHECKED)`.
@@ -219,4 +219,4 @@ In both cases OR-ed state values can be used as well. E.g. `lv_obj_add_state(obj
To learn more about the states read the related section of the [Style overview](/overview/style).
## Snapshot
A snapshot image could be generated for an object together with its children. Check details in [Snapshot](/others/snapshot).
A snapshot image can be generated for an object together with its children. Check details in [Snapshot](/others/snapshot).