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

@@ -50,7 +50,7 @@ The change rate is defined in degree/second unit and can be set with `lv_arc_set
It's also possible to set the angles of the indicator arc directly with `lv_arc_set_angles(arc, start_angle, end_angle)` function or `lv_arc_set_start/end_angle(arc, start_angle)`.
In this case the set "value" and "mode" are ignored.
In other words, settings angles and values are independent. You should use either value or angle settings. Mixing the two might result in unintended behavior.
In other words, the angle and value settings are independent. You should exclusively use one or the other. Mixing the two might result in unintended behavior.
To make the arc non-adjustable, remove the style of the knob and make the object non-clickable:
```c

View File

@@ -23,7 +23,7 @@ Options are passed to the Roller as a string with `lv_roller_set_options(roller,
You can select an option manually with `lv_roller_set_selected(roller, id, LV_ANIM_ON/OFF)`, where *id* is the index of an option.
### Get selected option
The get the *index* of the currently selected option use `lv_roller_get_selected(roller)`.
To get the *index* of the currently selected option use `lv_roller_get_selected(roller)`.
`lv_roller_get_selected_str(roller, buf, buf_size)` will copy the name of the selected option to `buf`.

View File

@@ -6,7 +6,7 @@
## Overview
A spangroup is the object that is used to display rich text. Different from the label object, `spangroup` can automatically organize text of different fonts, colors, and sizes into the spangroup obj.
A spangroup is the object that is used to display rich text. Different from the label object, `spangroup` can render text styled with different fonts, colors, and sizes into the spangroup object.
## Parts and Styles
- `LV_PART_MAIN` The spangroup has only one part.
@@ -15,7 +15,7 @@ A spangroup is the object that is used to display rich text. Different from the
### Set text and style
The spangroup object uses span to describe text and text style. so, first we need to create `span` descriptor using `lv_span_t * span = lv_spangroup_new_span(spangroup)`. Then use `lv_span_set_text(span, "text")` to set text.The style of the modified text is the same as the normal style used, eg:`lv_style_set_text_color(&span->style, lv_palette_main(LV_PALETTE_RED))`.
The spangroup object uses span to describe text and text style. so, first we need to create `span` descriptor using `lv_span_t * span = lv_spangroup_new_span(spangroup)`. Then use `lv_span_set_text(span, "text")` to set text. The style of the span is configured as with a normal style object by using its `style` member, eg:`lv_style_set_text_color(&span->style, lv_palette_main(LV_PALETTE_RED))`.
If spangroup object `mode != LV_SPAN_MODE_FIXED` you must call `lv_spangroup_refr_mode()` after you have modified `span` style(eg:set text, changed the font size, del span).

View File

@@ -7,7 +7,7 @@
## Overview
The Tile view is a container object whose elements (called *tiles*) can be arranged in grid form.
By swiping the user can navigate between the tiles.
A user can navigate between the tiles by swiping.
Any direction of swiping can be disabled on the tiles individually to not allow moving from one tile to another.
If the Tile view is screen sized, the user interface resembles what you may have seen on smartwatches.

View File

@@ -17,7 +17,7 @@ In object-oriented thinking, it is the base class from which all other objects i
The functions and functionalities of the Base object can be used with other widgets too. For example `lv_obj_set_width(slider, 100)`
The Base object can be directly used as a simple widget: it's nothing else than a rectangle. In HTML terms, think of it as a `<div>`.
The Base object can be directly used as a simple widget: it's nothing more than a rectangle. In HTML terms, think of it as a `<div>`.
### Coordinates
@@ -30,8 +30,8 @@ The object size can be modified on individual axes with `lv_obj_set_width(obj, n
You can set the position relative to the parent with `lv_obj_set_x(obj, new_x)` and `lv_obj_set_y(obj, new_y)`, or both axes at the same time with `lv_obj_set_pos(obj, new_x, new_y)`.
#### Alignment
You can align the object on its parent with `lv_obj_set_align(obj, LV_ALIGN_...)`. After this every x and y setting will be ralitive to the set alignment mode.
For example, this will shift the object by 10;20 px from the center of its parent.
You can align the object on its parent with `lv_obj_set_align(obj, LV_ALIGN_...)`. After this every x and y setting will be relative to the set alignment mode.
For example, this will shift the object by 10;20 px from the center of its parent:
```c
lv_obj_set_align(obj, LV_ALIGN_CENTER);
lv_obj_set_pos(obj, 10, 20);
@@ -40,7 +40,7 @@ lv_obj_set_pos(obj, 10, 20);
lv_obj_align(obj, LV_ALIGN_CENTER, 10, 20);
```
To align one object to another use `lv_obj_align_to(obj_to_align, obj_referece, LV_ALIGN_..., x, y)`
To align one object to another use: `lv_obj_align_to(obj_to_align, obj_referece, LV_ALIGN_..., x, y)`
For example, to align a text below an image: `lv_obj_align_to(text, image, LV_ALIGN_OUT_BOTTOM_MID, 0, 10)`.
@@ -51,21 +51,21 @@ The following align types exist:
### Parents and children
You can set a new parent for an object with `lv_obj_set_parent(obj, new_parent)`. To get the current parent, use `lv_obj_get_parent(obj)`.
To get a specific children of a parent use `lv_obj_get_child(parent, idx)`. Some examples for `idx`:
- `0` get the child created first child
To get a specific child of a parent use `lv_obj_get_child(parent, idx)`. Some examples for `idx`:
- `0` get the child created first
- `1` get the child created second
- `-1` get the child created last
The children can be iterated lke this
The children can be iterated lke this:
```c
uint32_t i;
for(i = 0; i < lv_obj_get_child_cnt(parent); i++) {
lv_obj_t * child = lv_obj_get_child(paernt, i);
lv_obj_t * child = lv_obj_get_child(parent, i);
/*Do something with child*/
}
```
`lv_obj_get_index(obj)` returns the index of the object. That is how many younger children its parent has.
`lv_obj_get_index(obj)` returns the index of the object in its parent. It is equivalent to the number of younger children in the parent.
You can bring an object to the foreground or send it to the background with `lv_obj_move_foreground(obj)` and `lv_obj_move_background(obj)`.
@@ -73,10 +73,13 @@ You can change the index of an object in its parent using `lv_obj_move_to_index
You can swap the position of two objects with `lv_obj_swap(obj1, obj2)`.
### Screens
When you have created a screen like `lv_obj_t * screen = lv_obj_create(NULL)`, you can load it with `lv_scr_load(screen)`. The `lv_scr_act()` function gives you a pointer to the current screen.
### Display and Screens
If you have multiple displays then it's important to know that these functions operate on the most-recently created or on the explicitly selected (with `lv_disp_set_default`) display.
At the highest level of the LVGL object hierarchy is the *display* which represents the driver for a display device (physical display or simulator). A display can have one or more screens associated with it. Each screen contains a hierarchy of objects for graphical widgets representing a layout that covers the entire display.
When you have created a screen like `lv_obj_t * screen = lv_obj_create(NULL)`, you can make it active with `lv_scr_load(screen)`. The `lv_scr_act()` function gives you a pointer to the active screen.
If you have multiple displays, it's important to know that the screen functions operate on the most recently created display or the one explicitly selected with `lv_disp_set_default`.
To get an object's screen use the `lv_obj_get_screen(obj)` function.
@@ -86,14 +89,14 @@ To set an event callback for an object, use `lv_obj_add_event_cb(obj, event_cb,
To manually send an event to an object, use `lv_event_send(obj, LV_EVENT_..., param)`
Read the [Event overview](/overview/event) to learn more about the events.
Read the [Event overview](/overview/event) to learn more about events.
### Styles
Be sure to read the [Style overview](/overview/style). Here only the most essential functions are described.
A new style can be added to an object with `lv_obj_add_style(obj, &new_style, selector)` function.
`selector` is a combination of part and state(s). E.g. `LV_PART_SCROLLBAR | LV_STATE_PRESSED`.
A new style can be added to an object with the `lv_obj_add_style(obj, &new_style, selector)` function.
`selector` is an ORed combination of part and state(s). E.g. `LV_PART_SCROLLBAR | LV_STATE_PRESSED`.
The base objects use `LV_PART_MAIN` style properties and `LV_PART_SCROLLBAR` with the typical backgroud style properties.
@@ -102,7 +105,7 @@ The base objects use `LV_PART_MAIN` style properties and `LV_PART_SCROLLBAR` wit
There are some attributes which can be enabled/disabled by `lv_obj_add/clear_flag(obj, LV_OBJ_FLAG_...)`:
- `LV_OBJ_FLAG_HIDDEN` Make the object hidden. (Like it wasn't there at all)
- `LV_OBJ_FLAG_CLICKABLE` Make the object clickable by the input devices
- `LV_OBJ_FLAG_CLICKABLE` Make the object clickable by input devices
- `LV_OBJ_FLAG_CLICK_FOCUSABLE` Add focused state to the object when clicked
- `LV_OBJ_FLAG_CHECKABLE` Toggle checked state when the object is clicked
- `LV_OBJ_FLAG_SCROLLABLE` Make the object scrollable
@@ -115,8 +118,8 @@ There are some attributes which can be enabled/disabled by `lv_obj_add/clear_fla
- `LV_OBJ_FLAG_PRESS_LOCK` Keep the object pressed even if the press slid from the object
- `LV_OBJ_FLAG_EVENT_BUBBLE` Propagate the events to the parent too
- `LV_OBJ_FLAG_GESTURE_BUBBLE` Propagate the gestures to the parent
- `LV_OBJ_FLAG_ADV_HITTEST` Allow performing more accurate hit (click) test. E.g. consider rounded corners.
- `LV_OBJ_FLAG_IGNORE_LAYOUT` Make the object position-able by the layouts
- `LV_OBJ_FLAG_ADV_HITTEST` Allow performing more accurate hit (click) test. E.g. accounting for rounded corners
- `LV_OBJ_FLAG_IGNORE_LAYOUT` Make the object positionable by the layouts
- `LV_OBJ_FLAG_FLOATING` Do not scroll the object when the parent scrolls and ignore layout
- `LV_OBJ_FLAG_LAYOUT_1` Custom flag, free to use by layouts
@@ -128,20 +131,20 @@ There are some attributes which can be enabled/disabled by `lv_obj_add/clear_fla
- `LV_OBJ_FLAG_USER_1` Custom flag, free to use by user
- `LV_OBJ_FLAG_USER_2` Custom flag, free to use by user
- `LV_OBJ_FLAG_USER_3` Custom flag, free to use by user
- `LV_OBJ_FLAG_USER_4` Custom flag, free to use by usersection.
- `LV_OBJ_FLAG_USER_4` Custom flag, free to use by user
Some examples:
```c
/*Hide on object*/
lv_obj_add_flag(obj, LV_OBJ_FLAG_HIDDEN);
/*Make an obejct non-clickable*/
/*Make an object non-clickable*/
lv_obj_clear_flag(obj, LV_OBJ_FLAG_CLICKABLE);
```
### Groups
Read the [Input devices overview](/overview/indev) to learn more about the *Groups*.
Read the [Input devices overview](/overview/indev) to learn more about *Groups*.
Objects are added to a *group* with `lv_group_add_obj(group, obj)`, and you can use `lv_obj_get_group(obj)` to see which group an object belongs to.
@@ -149,7 +152,7 @@ Objects are added to a *group* with `lv_group_add_obj(group, obj)`, and you can
### Extended click area
By default, the objects can be clicked only on their coordinates, however, this area can be extended with `lv_obj_set_ext_click_area(obj, size)`.
By default, the objects can be clicked only within their bounding area. However, this can be extended with `lv_obj_set_ext_click_area(obj, size)`.
## Events
- `LV_EVENT_VALUE_CHANGED` when the `LV_OBJ_FLAG_CHECKABLE` flag is enabled and the object clicked (on transition to/from the checked state)