Spelling and other language fixes to documentation (#2293)
This commit is contained in:
committed by
Gabor Kiss-Vamosi
parent
ad9de31a05
commit
1deff8ed03
@@ -6,27 +6,27 @@
|
||||
|
||||
## Overview
|
||||
|
||||
The Arc are consists of a background and a foreground arc. The foregrond (indicator) arc can be adjusted by finger.
|
||||
The Arc consists of a background and a foreground arc. The foregrond (indicator) can be touch-adjusted.
|
||||
|
||||
## Parts and Styles
|
||||
- `LV_PART_MAIN` It draws a background using the typical background style properties and an arc using the arc style properties. The arc's size and position will respect the *padding* style properties.
|
||||
- `LV_PART_INDICATOR` It draws an other arc using the *arc* style properties. It's padding values are interpreted relative to the background arc.
|
||||
- `LV_PART_KNOB`It draws a handle on the end of the indicator. It uses all background properties and padding values. With zero padding the knob size is the same as the indicator's width.
|
||||
- `LV_PART_MAIN` Draws a background using the typical background style properties and an arc using the arc style properties. The arc's size and position will respect the *padding* style properties.
|
||||
- `LV_PART_INDICATOR` Draws an other arc using the *arc* style properties. Its padding values are interpreted relative to the background arc.
|
||||
- `LV_PART_KNOB` Draws a handle on the end of the indicator using all background properties and padding values. With zero padding the knob size is the same as the indicator's width.
|
||||
Larger padding makes it larger, smaller padding makes it smaller.
|
||||
|
||||
## Usage
|
||||
|
||||
### Value and range
|
||||
|
||||
A new value can be set by `lv_arc_set_value(arc, new_value)`.
|
||||
A new value can be set using `lv_arc_set_value(arc, new_value)`.
|
||||
The value is interpreted in a range (minimum and maximum values) which can be modified with `lv_arc_set_range(arc, min, max)`.
|
||||
The default range is 1..100.
|
||||
|
||||
The indicator arc is drawn on the main part's arc. That is if the vale is set to maximum the indicator arc will cover the entire "background" arc.
|
||||
To set the start and end angl of the background arc use the `lv_arc_set_bg_angles(arc, start_angle, end_angle)` function or `lv_arc_set_bg_start/end_angle(arc, start_angle)`.
|
||||
The indicator arc is drawn on the main part's arc. This if the value is set to maximum the indicator arc will cover the entire "background" arc.
|
||||
To set the start and end angle of the background arc use the `lv_arc_set_bg_angles(arc, start_angle, end_angle)` functions or `lv_arc_set_bg_start/end_angle(arc, angle)`.
|
||||
|
||||
Zero degree is at the middle right (3 o'clock) of the object and the degrees are increasing in clockwise direction.
|
||||
The angles should be in [0;360] range.
|
||||
Zero degrees is at the middle right (3 o'clock) of the object and the degrees are increasing in clockwise direction.
|
||||
The angles should be in the [0;360] range.
|
||||
|
||||
### Rotation
|
||||
|
||||
@@ -36,23 +36,23 @@ An offset to the 0 degree position can added with `lv_arc_set_rotation(arc, deg)
|
||||
|
||||
The arc can be one of the following modes:
|
||||
- `LV_ARC_MODE_NORMAL` The indicator arc is drawn from the minimimum value to the current.
|
||||
- `LV_ARC_MODE_REVERSE` The indicator arc is drawn counter clockwise from the maximum value to the current.
|
||||
- `LV_ARC_MODE_REVERSE` The indicator arc is drawn counter-clockwise from the maximum value to the current.
|
||||
- `LV_ARC_MODE_SYMMETRICAL` The indicator arc is drawn from the middle point to the current value.
|
||||
|
||||
The mode can be set by `lv_arc_set_mode(arc, LV_ARC_MODE_...)` and used only if the the angle is set by `lv_arc_set_value()` or the arc is adjusted by finger.
|
||||
|
||||
### Change rate
|
||||
If the the arc is pressed the current value will set with a limited speed according to the set *change rate*.
|
||||
If the arc is pressed the current value will set with a limited speed according to the set *change rate*.
|
||||
The change rate is defined in degree/second unit and can be set with `lv_arc_set_change_rage(arc, rate)`
|
||||
|
||||
|
||||
### Setting the indicator manually
|
||||
It also possible to set the angles o 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)` sets the angles of the indicator arc.
|
||||
It 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" is ignored.
|
||||
|
||||
In other words, settings angles and values are independent. You should use either value and angle settings. Mixing the two might result unintended behavior.
|
||||
In other words, settings angles and values are independent. You should use either value and angle settings. Mixing the two might result in unintended behavior.
|
||||
|
||||
To make the arc non-adjutabe remove the style of the knob and make the object non-clickable:
|
||||
To make the arc non-adjustabe remove the style of the knob and make the object non-clickable:
|
||||
```c
|
||||
lv_obj_remove_style(arc, NULL, LV_PART_KNOB);
|
||||
lv_obj_clear_flag(arc, LV_OBJ_FLAG_CLICKABLE);
|
||||
@@ -61,7 +61,7 @@ lv_obj_clear_flag(arc, LV_OBJ_FLAG_CLICKABLE);
|
||||
## Events
|
||||
- `LV_EVENT_VALUE_CHANGED` sent when the arc is pressed/dragged to set a new value.
|
||||
- `LV_EVENT_DRAW_PART_BEGIN` and `LV_EVENT_DRAW_PART_END` are sent for the background rectangle, the background arc, the foreground arc and the knob to allow hooking the drawing.
|
||||
For more detail on the backround rectangle part see the [Base object](/widgets/obj#events)'s documentation. The fields of `lv_obj_draw_dsc_t` is set like the followings:
|
||||
For more detail on the backround rectangle part see the [Base object](/widgets/obj#events)'s documentation. The fields of `lv_obj_draw_dsc_t` are set as follows:
|
||||
- For both arcs: `clip_area`, `p1` (center of the arc), `radius`, `arc_dsc`, `part`.
|
||||
- For the knob: `clip_area`, `draw_area`, `rect_dsc`, `part`.
|
||||
|
||||
|
||||
@@ -10,12 +10,12 @@ The bar object has a background and an indicator on it. The width of the indicat
|
||||
|
||||
Vertical bars can be created if the width of the object is smaller than its height.
|
||||
|
||||
Not only the end, but the start value of the bar can be set which changes the start position of the indicator.
|
||||
Not only the end, but also the start value of the bar can be set, which changes the start position of the indicator.
|
||||
|
||||
|
||||
## Parts and Styles
|
||||
- `LV_PART_MAIN` The background of the bar and it uses the typical background style properties. Adding padding makes the indicator smaller or larger. The `anim_time` style property sets the animation time if the values set with `LV_ANIM_ON`.
|
||||
- `LV_PART_INDICATOR` The indicator and it also also uses all the typical background properties.
|
||||
- `LV_PART_INDICATOR` The indicator itself; also also uses all the typical background properties.
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -29,12 +29,11 @@ The new value in `lv_bar_set_value` can be set with or without an animation depe
|
||||
### Modes
|
||||
The bar can be one the following modes:
|
||||
- `LV_BAR_MODE_NORMAL` A normal bar as described above
|
||||
- `LV_BAR_SYMMETRICAL` Draw the indicator form the zero value to current value. Requires negaitve minimum range and positive maximum range.
|
||||
- `LV_BAR_RANGE` Allows setting the start value too by `lv_bar_set_start_value(bar, new_value, LV_ANIM_ON/OFF)`. The start value has to be always smaller than the end value.
|
||||
- `LV_BAR_SYMMETRICAL` Draw the indicator from the zero value to current value. Requires a negative minimum range and positive maximum range.
|
||||
- `LV_BAR_RANGE` Allows setting the start value too by `lv_bar_set_start_value(bar, new_value, LV_ANIM_ON/OFF)`. The start value always has to be smaller than the end value.
|
||||
|
||||
## Events
|
||||
- `LV_EVENT_DRAW_PART_BEGIN` and `LV_EVENT_DRAW_PART_END` are sent for both main and indicator parts to allow hooking the drawing.
|
||||
The for more detail on the main part see the [Base object](/widgets/obj#events)'s documentation.
|
||||
- `LV_EVENT_DRAW_PART_BEGIN` and `LV_EVENT_DRAW_PART_END` are sent for both main and indicator parts to allow hooking the drawing. For more detail on the main part see the [Base object](/widgets/obj#events)'s documentation.
|
||||
For the indicator the following fields are used: `clip_area`, `draw_area`, `rect_dsc`, `part`.
|
||||
|
||||
Learn more about [Events](/overview/event).
|
||||
|
||||
@@ -6,30 +6,30 @@
|
||||
|
||||
## Overview
|
||||
|
||||
Buttons has no new features compared to the [Base object](/widgets/obj). It usufule for semantic purposes and has slightly different default settings.
|
||||
Buttons have no new features compared to the [Base object](/widgets/obj). They are usuful for semantic purposes and have slightly different default settings.
|
||||
|
||||
Buttons differ from Base object in the following points by default:
|
||||
Buttons, by default, differ from Base object in the following ways:
|
||||
- Not scrollable
|
||||
- Added to the default group
|
||||
- Its default height and width is `LV_SIZE_CONTENT`
|
||||
- Default height and width set to `LV_SIZE_CONTENT`
|
||||
|
||||
## Parts and Styles
|
||||
- `LV_PART_MAIN` The background of the button. It uses the typical background style properties.
|
||||
- `LV_PART_MAIN` The background of the button. Uses the typical background style properties.
|
||||
|
||||
## Usage
|
||||
|
||||
There are no new features compared to [Base object](/widgets/obj).
|
||||
|
||||
## Events
|
||||
- `LV_EVENT_VALUE_CHANGED` when the `LV_OBJ_FLAG_CHECKABLE` flag is enabled and the obejct clicked (on transition to/from the checked state)
|
||||
- `LV_EVENT_VALUE_CHANGED` when the `LV_OBJ_FLAG_CHECKABLE` flag is enabled and the object is clicked. The event happens on transition to/from the checked state.
|
||||
|
||||
|
||||
Learn more about [Events](/overview/event).
|
||||
|
||||
## Keys
|
||||
If `LV_OBJ_FLAG_CHECKABLE` is enabled `LV_KEY_RIGHT` and `LV_KEY_UP` makes the object checked, and `LV_KEY_LEFT` and `LV_KEY_DOWN` makes it unchecked.
|
||||
If `LV_OBJ_FLAG_CHECKABLE` is enabled `LV_KEY_RIGHT` and `LV_KEY_UP` make the object checked, and `LV_KEY_LEFT` and `LV_KEY_DOWN` make it unchecked.
|
||||
|
||||
Note that, the state of `LV_KEY_ENTER` is translated to `LV_EVENT_PRESSED/PRESSING/RELEASED` etc.
|
||||
Note that the state of `LV_KEY_ENTER` is translated to `LV_EVENT_PRESSED/PRESSING/RELEASED` etc.
|
||||
|
||||
Learn more about [Keys](/overview/indev).
|
||||
|
||||
|
||||
@@ -6,16 +6,13 @@
|
||||
|
||||
## Overview
|
||||
|
||||
The Button Matrix objects can display multiple buttons in rows and columns.
|
||||
The Button Matrix object is a lightweight way to display multiple buttons in rows and columns. Lightweight because the buttons are not actually created but just virtually drawn on the fly. This way, one button use only eight extra bytes of memory instead of the ~100-150 bytes a normal [Button](/widgets/core/btn) object plus the 100 or so bytes for the the [Label](/widgets/core/label) object.
|
||||
|
||||
The Button matrix object is very light weighted because the buttons are not created just virtually drawn on the fly.
|
||||
This way, 1 button use only 8 extra bytes instead of the ~100-150 byte size of a normal [Button](/widgets/core/btn) object and other ~100 byte for the size of the [Label](/widgets/core/label) object.
|
||||
|
||||
The Button matrix is added to the deafult group (if it is set). Besides the Button matrix is an editable object to allow selecting and clicing the buttons with encoder navigation too.
|
||||
The Button matrix is added to the default group (if one is set). Besides the Button matrix is an editable object to allow selecting and clicking the buttons with encoder navigation too.
|
||||
|
||||
## Parts and Styles
|
||||
- `LV_PART_MAIN` The bacground of the button matrix. It uses the typical background style properties. `pad_row` and `pad_column` sets the space between the buttons.
|
||||
- `LV_PART_ITEMS` The buttons and they all use the text and typical background style properties expect translations and transformations.
|
||||
- `LV_PART_MAIN` The background of the button matrix, uses the typical background style properties. `pad_row` and `pad_column` sets the space between the buttons.
|
||||
- `LV_PART_ITEMS` The buttons all use the text and typical background style properties except translations and transformations.
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -23,16 +20,16 @@ The Button matrix is added to the deafult group (if it is set). Besides the Butt
|
||||
There is a text on each button. To specify them a descriptor string array, called *map*, needs to be used.
|
||||
The map can be set with `lv_btnmatrix_set_map(btnm, my_map)`.
|
||||
The declaration of a map should look like `const char * map[] = {"btn1", "btn2", "btn3", NULL}`.
|
||||
Note that, the last element has to be `NULL` or an empty string (`""`)!
|
||||
Note that the last element has to be either `NULL` or an empty string (`""`)!
|
||||
|
||||
Use `"\n"` in the map to make **line break**. E.g. `{"btn1", "btn2", "\n", "btn3", ""}`. Each line's buttons have their width calculated automatically.
|
||||
Use `"\n"` in the map to insert a **line break**. E.g. `{"btn1", "btn2", "\n", "btn3", ""}`. Each line's buttons have their width calculated automatically.
|
||||
So in the example the first row will have 2 buttons each with 50% width and a second row with 1 button having 100% width.
|
||||
|
||||
### Control buttons
|
||||
The buttons' width can be set relative to the other button in the same row with `lv_btnmatrix_set_btn_width(btnm, btn_id, width)`
|
||||
E.g. in a line with two buttons: *btnA, width = 1* and *btnB, width = 2*, *btnA* will have 33 % width and *btnB* will have 66 % width.
|
||||
It's similar to how the [`flex-grow`](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-grow) property works in CSS.
|
||||
The width's value mus be in the \[1..7\] range and the deafult width is 1.
|
||||
The width must be in the \[1..7\] range and the default width is 1.
|
||||
|
||||
In addition to the width, each button can be customized with the following parameters:
|
||||
- `LV_BTNMATRIX_CTRL_HIDDEN` Makes a button hidden (hidden buttons still take up space in the layout, they are just not visible or clickable)
|
||||
@@ -45,7 +42,7 @@ In addition to the width, each button can be customized with the following param
|
||||
- `LV_BTNMATRIX_CTRL_CUSTOM_1` Custom free to use flag
|
||||
- `LV_BTNMATRIX_CTRL_CUSTOM_2` Custom free to use flag
|
||||
|
||||
By deafult all flags are disabled.
|
||||
By default all flags are disabled.
|
||||
|
||||
To set or clear a button's control attribute, use `lv_btnmatrix_set_btn_ctrl(btnm, btn_id, LV_BTNM_CTRL_...)` and
|
||||
`lv_btnmatrix_clear_btn_ctrl(btnm, btn_id, LV_BTNMATRIX_CTRL_...)` respectively. More `LV_BTNM_CTRL_...` values can be OR-ed
|
||||
@@ -58,15 +55,15 @@ An element of `ctrl_map` should look like `ctrl_map[0] = width | LV_BTNM_CTRL_NO
|
||||
The number of elements should be equal to the number of buttons (excluding newlines characters).
|
||||
|
||||
### One check
|
||||
The "One check" feature can be enabled with `lv_btnmatrix_set_one_check(btnm, true)` to allow only one button to be checked at once.
|
||||
The "One check" feature can be enabled with `lv_btnmatrix_set_one_check(btnm, true)` to allow only one button to be checked at a time.
|
||||
|
||||
## Events
|
||||
- `LV_EVENT_VALUE_CHANGED` Sent when a button is pressed/released or repeated after long press. The event paramter is set to the ID of the pressed/released button.
|
||||
- `LV_EVENT_VALUE_CHANGED` Sent when a button is pressed/released or repeated after long press. The event parameter is set to the ID of the pressed/released button.
|
||||
- `LV_EVENT_DRAW_PART_BEGIN` and `LV_EVENT_DRAW_PART_END` are sent for both the main and the items (buttons) parts to allow hooking the drawing.
|
||||
The for more detail on the main part see the [Base object](/widgets/obj#events)'s documentation.
|
||||
For more detail on the main part see the [Base object](/widgets/obj#events)'s documentation.
|
||||
For the buttons the following fields are used: `clip_area`, `draw_area`, `rect_dsc`, `rect_dsc`, `part`, `id` (index of the button being drawn).
|
||||
|
||||
`lv_btnmatrix_get_selected_btn(btnm)` returns the index of the lastly pressed, released or focused button or `LV_BTNMATRIX_BTN_NONE` if no such button.
|
||||
`lv_btnmatrix_get_selected_btn(btnm)` returns the index of the most recently released or focused button or `LV_BTNMATRIX_BTN_NONE` if no such button.
|
||||
|
||||
`lv_btnmatrix_get_btn_text(btnm, btn_id)` returns a pointer to the text of `btn_id`th button.
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
|
||||
## Overview
|
||||
|
||||
A Canvas inherites from [Image](/widgets/core/img) where the user can draw anything.
|
||||
A Canvas inherits from [Image](/widgets/core/img) where the user can draw anything.
|
||||
Rectangles, texts, images, lines, arcs can be drawn here using lvgl's drawing engine.
|
||||
Besides some "effects" can be applied as well like rotation, zoom and blur.
|
||||
Additionally "effects" can be applied, such as rotation, zoom and blur.
|
||||
|
||||
|
||||
## Parts and Styles
|
||||
@@ -18,7 +18,7 @@ Besides some "effects" can be applied as well like rotation, zoom and blur.
|
||||
## Usage
|
||||
|
||||
### Buffer
|
||||
The Canvas needs a buffer which stores the drawn image.
|
||||
The Canvas needs a buffer in which stores the drawn image.
|
||||
To assign a buffer to a Canvas, use `lv_canvas_set_buffer(canvas, buffer, width, height, LV_IMG_CF_...)`.
|
||||
Where `buffer` is a static buffer (not just a local variable) to hold the image of the canvas.
|
||||
For example,
|
||||
@@ -37,7 +37,7 @@ To set a pixel on the canvas, use `lv_canvas_set_px(canvas, x, y, LV_COLOR_RED)`
|
||||
With `LV_IMG_CF_INDEXED_...` or `LV_IMG_CF_ALPHA_...`, the index of the color or the alpha value needs to be passed as color.
|
||||
E.g. `lv_color_t c; c.full = 3;`
|
||||
|
||||
`lv_canvas_fill_bg(canvas, LV_COLOR_BLUE, LV_OPA_50)` fills the whole canvas to blue with 50% opacity. Note that, if the current color format doesn't support colors (e.g. `LV_IMG_CF_ALPHA_2BIT`) the color will be ignored.
|
||||
`lv_canvas_fill_bg(canvas, LV_COLOR_BLUE, LV_OPA_50)` fills the whole canvas to blue with 50% opacity. Note that if the current color format doesn't support colors (e.g. `LV_IMG_CF_ALPHA_2BIT`) the color will be ignored.
|
||||
Similarly, if opacity is not supported (e.g. `LV_IMG_CF_TRUE_COLOR`) it will be ignored.
|
||||
|
||||
An array of pixels can be copied to the canvas with `lv_canvas_copy_buf(canvas, buffer_to_copy, x, y, width, height)`.
|
||||
@@ -51,7 +51,7 @@ To draw something to the canvas use
|
||||
- `lv_canvas_draw_polygon(canvas, points_array, point_cnt, &draw_dsc)`
|
||||
- `lv_canvas_draw_arc(canvas, x, y, radius, start_angle, end_angle, &draw_dsc)`
|
||||
|
||||
`draw_dsc` is a `lv_draw_rect/label/img/line/arc_dsc_t` variable which should be first initialized with `lv_draw_rect/label/img/line/arc_dsc_init()` function and then it's filed should be modified with the desired colors and other values.
|
||||
`draw_dsc` is a `lv_draw_rect/label/img/line/arc_dsc_t` variable which should be first initialized with one of `lv_draw_rect/label/img/line/arc_dsc_init()` and then modified with the desired colors and other values.
|
||||
|
||||
The draw function can draw to any color format. For example, it's possible to draw a text to an `LV_IMG_VF_ALPHA_8BIT` canvas and use the result image as a [draw mask](/overview/drawing) later.
|
||||
|
||||
@@ -61,7 +61,7 @@ The function needs the following parameters:
|
||||
- `canvas` pointer to a canvas object to store the result of the transformation.
|
||||
- `img pointer` to an image descriptor to transform. Can be the image descriptor of an other canvas too (`lv_canvas_get_img()`).
|
||||
- `angle` the angle of rotation (0..3600), 0.1 deg resolution
|
||||
- `zoom` zoom factor (256 no zoom, 512 double size, 128 half size);
|
||||
- `zoom` zoom factor (256: no zoom, 512: double size, 128: half size);
|
||||
- `offset_x` offset X to tell where to put the result data on destination canvas
|
||||
- `offset_y` offset X to tell where to put the result data on destination canvas
|
||||
- `pivot_x` pivot X of rotation. Relative to the source canvas. Set to `source width / 2` to rotate around the center
|
||||
@@ -72,10 +72,10 @@ Note that a canvas can't be rotated on itself. You need a source and destinatio
|
||||
|
||||
### Blur
|
||||
A given area of the canvas can be blurred horizontally with `lv_canvas_blur_hor(canvas, &area, r)` or vertically with `lv_canvas_blur_ver(canvas, &area, r)`.
|
||||
`r` is the radius of the blur (greater value means more intensive burring). `area` is the area where the blur should be applied (interpreted relative to the canvas)
|
||||
`r` is the radius of the blur (greater value means more intensive burring). `area` is the area where the blur should be applied (interpreted relative to the canvas).
|
||||
|
||||
## Events
|
||||
The same events are sent than for the [Images](/widgets/core/img).
|
||||
The same events are sent as for the [Images](/widgets/core/img).
|
||||
|
||||
Learn more about [Events](/overview/event).
|
||||
|
||||
|
||||
@@ -7,29 +7,27 @@
|
||||
|
||||
## Overview
|
||||
|
||||
The Checkbox object is created from a "tick box" and a label.
|
||||
When the Chackbox is clicked the tick box is toggled.
|
||||
The Checkbox object is created from a "tick box" and a label. When the Chackbox is clicked the tick box is toggled.
|
||||
|
||||
## Parts and Styles
|
||||
- `LV_PART_MAIN` The is the background of the Checkbox and it uses the text and all the typical backround style properties.
|
||||
`pad_column` adjusts the spacing between the tickbox and the label
|
||||
- `LV_PART_INDICATOR` The "tick box" is a square the uses all the typical backround style properties.
|
||||
By deafult its size is equal to the height of the main part's font. Padding properties makes the tick boy larger in the respectiev directions.
|
||||
- `LV_PART_INDICATOR` The "tick box" is a square that uses all the typical backround style properties.
|
||||
By default its size is equal to the height of the main part's font. Padding properties make the tick box larger in the respective directions.
|
||||
|
||||
The Checkbox is added to the deafult group (if it is set).
|
||||
The Checkbox is added to the default group (if it is set).
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
### Text
|
||||
The text can be modified by the `lv_checkbox_set_text(cb, "New text")` function.
|
||||
It will dynamically allocate the text.
|
||||
The text can be modified with the `lv_checkbox_set_text(cb, "New text")` function and will be dynamically allocated.
|
||||
|
||||
To set a static text,
|
||||
use `lv_checkbox_set_static_text(cb, txt)`. This way, only a pointer of `txt` will be stored and it shouldn't be deallocated while the checkbox exists.
|
||||
use `lv_checkbox_set_static_text(cb, txt)`. This way, only a pointer to `txt` will be stored. The text then shouldn't be deallocated while the checkbox exists.
|
||||
|
||||
### Check, uncheck, disable
|
||||
You can manually check, un-check, and disable the Checkbox by using the common state state add/clear function:
|
||||
You can manually check, un-check, and disable the Checkbox by using the common state add/clear function:
|
||||
```c
|
||||
lv_obj_add_state(cb, LV_STATE_CHECKED); /*Make the chekbox checked*/
|
||||
lv_obj_clear_state(cb, LV_STATE_CHECKED); /*MAke the checkbox unchecked*/
|
||||
@@ -39,7 +37,7 @@ lv_obj_add_state(cb, LV_STATE_CHECKED | LV_STATE_DISABLED); /*Make the checkbox
|
||||
## Events
|
||||
- `LV_EVENT_VALUE_CHANGED` Sent when the checkbox is toggled.
|
||||
- `LV_EVENT_DRAW_PART_BEGIN` and `LV_EVENT_DRAW_PART_END` are sent for both main and indicator parts to allow hooking the drawing.
|
||||
The for more detail on the main part see the [Base object](/widgets/obj#events)'s documentation.
|
||||
For more detail on the main part see the [Base object](/widgets/obj#events)'s documentation.
|
||||
For the indicator the following fields are used: `clip_area`, `draw_area`, `rect_dsc`, `part`.
|
||||
|
||||
Learn more about [Events](/overview/event).
|
||||
|
||||
@@ -11,72 +11,70 @@ The drop-down list allows the user to select one value from a list.
|
||||
|
||||
The drop-down list is closed by default and displays a single value or a predefined text.
|
||||
When activated (by click on the drop-down list), a list is created from which the user may select one option.
|
||||
When the user selects a new value, the list is deleted.
|
||||
When the user selects a new value, the list is deleted again.
|
||||
|
||||
The Drop-down list is added to the deafult group (if it is set). Besides the Drop-down list is an editable object to allow selecting an option with encoder navigation too.
|
||||
The Drop-down list is added to the default group (if it is set). Besides the Drop-down list is an editable object to allow selecting an option with encoder navigation too.
|
||||
|
||||
## Parts and Styles
|
||||
The Dropdown widgets is built from the elements: a "button" and a "list" (they are not realted to the butto and list widgets)
|
||||
The Dropdown widget is built from the elements: "button" and "list" (both not related to the button and list widgets)
|
||||
|
||||
### Button
|
||||
- `LV_PART_MAIN` The background of the button. It uses the typicaly background proeprties and text proeprties for the text on it.
|
||||
- `LV_PART_MAIN` The background of the button. Uses the typical background properties and text properties for the text on it.
|
||||
- `LV_PART_INDICATOR` Typically an arrow symbol that can be an image or a text (`LV_SYMBOL`).
|
||||
|
||||
The button goes to `LV_STATE_CHECKED` when its opened.
|
||||
|
||||
### List
|
||||
- `LV_PART_MAIN` The list itself and it uses the typical background proeprties. `max_height` can be used to limit the height of the list.
|
||||
- `LV_PART_SCROLLBAR` The scrollbar the background, border, shadow properties and width (for its width) and right padding for the spacing on the right.
|
||||
- `LV_PART_SELECTED` Refers to the currently pressed, checked or prssed+checked option.
|
||||
It also uses the typical background properties.
|
||||
- `LV_PART_MAIN` The list itself. Uses the typical background properties. `max_height` can be used to limit the height of the list.
|
||||
- `LV_PART_SCROLLBAR` The scrollbar background, border, shadow properties and width (for its own width) and right padding for the spacing on the right.
|
||||
- `LV_PART_SELECTED` Refers to the currently pressed, checked or pressed+checked option. Also uses the typical background properties.
|
||||
|
||||
As the list not exists when the drop-down list is closed it's not possible to simply add styles to it.
|
||||
As list does not exist when the drop-down list is closed it's not possible to simply add styles to it.
|
||||
Instead the following should be done:
|
||||
1. Ad an event handler to the button for `LV_EVENT_VALUE_CHANGED` (triggered when the list is opened/closed)
|
||||
2. Use `lv_obj_t * list = lv_dropdown_get_list(dropdown)`
|
||||
3. `if(list != NULL) {/*Add the styles to the list*/}`
|
||||
|
||||
Alternatively the the theme can be extended with the new styles.
|
||||
Alternatively the theme can be extended with the new styles.
|
||||
|
||||
## Usage
|
||||
|
||||
## Overview
|
||||
|
||||
### Set options
|
||||
The options are passed to the drop-down list as a string with `lv_dropdown_set_options(dropdown, options)`. The options should be separated by `\n`. For example: `"First\nSecond\nThird"`.
|
||||
The string will be saved in the drop-down list, so it can in local variable too.
|
||||
Options are passed to the drop-down list as a string with `lv_dropdown_set_options(dropdown, options)`. Options should be separated by `\n`. For example: `"First\nSecond\nThird"`. This string will be saved in the drop-down list, so it can in a local variable.
|
||||
|
||||
The `lv_dropdown_add_option(dropdown, "New option", pos)` function inserts a new option to `pos` index.
|
||||
|
||||
To save memory the options can set from a static(constant) string too with `lv_dropdown_set_static_options(dropdown, options)`.
|
||||
In this case the options string should be alive while the drop-down list exists and `lv_dropdown_add_option` can't be used
|
||||
In this case the options string should be alive while the drop-down list exists and `lv_dropdown_add_option` can't be used
|
||||
|
||||
You can select an option manually with `lv_dropdown_set_selected(dropdown, id)`, where `id` is the index of an option.
|
||||
|
||||
### Get selected option
|
||||
The get the currently selected option, use `lv_dropdown_get_selected(dropdown)`. It will return the *index* of the selected option.
|
||||
The get the *index* of the selected option, use `lv_dropdown_get_selected(dropdown)`.
|
||||
|
||||
`lv_dropdown_get_selected_str(dropdown, buf, buf_size)` copies the name of the selected option to a `buf`.
|
||||
`lv_dropdown_get_selected_str(dropdown, buf, buf_size)` copies the *name* of the selected option to `buf`.
|
||||
|
||||
### Direction
|
||||
The list can be created on any side. The default `LV_DIR_BOTTOM` can be modified by `lv_dropdown_set_dir(dropdown, LV_DIR_LEFT/RIGHT/UP/BOTTOM)` function.
|
||||
|
||||
If the list would be vertically out of the screen, it will aligned to the edge.
|
||||
If the list would be vertically out of the screen, it will be aligned to the edge.
|
||||
|
||||
### Symbol
|
||||
A symbol (typically an arrow) can be added to the drop down list with `lv_dropdown_set_symbol(dropdown, LV_SYMBOL_...)`
|
||||
|
||||
If the direction of the drop-down list is `LV_DIR_LEFT` the symbol will be shown on the left, else on the right.
|
||||
If the direction of the drop-down list is `LV_DIR_LEFT` the symbol will be shown on the left, otherwise on the right.
|
||||
|
||||
### Show selected
|
||||
The main part can either show the selected option or a static text. If a static is set with `lv_dropdown_set_text(dropdown, "Some text")` it will be shown regardless to th selected option.
|
||||
Id the text text is `NULL` the selected option is displayed on the button.
|
||||
If the text is `NULL` the selected option is displayed on the button.
|
||||
|
||||
### Manually open/close
|
||||
To manually open or close the drop-down list the `lv_dropdown_open/close(dropdown)` function can be used.
|
||||
|
||||
## Events
|
||||
Besides the [Generic events](../overview/event.html#generic-events), the following [Special events](../overview/event.html#special-events) are sent by the drop-down list:
|
||||
Apart from the [Generic events](../overview/event.html#generic-events), the following [Special events](../overview/event.html#special-events) are sent by the drop-down list:
|
||||
- `LV_EVENT_VALUE_CHANGED` Sent when the new option is selected or the list is opened/closed.
|
||||
|
||||
Learn more about [Events](/overview/event).
|
||||
@@ -84,7 +82,7 @@ Learn more about [Events](/overview/event).
|
||||
## Keys
|
||||
- `LV_KEY_RIGHT/DOWN` Select the next option.
|
||||
- `LV_KEY_LEFT/UP` Select the previous option.
|
||||
- `LY_KEY_ENTER` Apply the selected option (Send `LV_EVENT_VALUE_CHANGED` event and close the drop-down list).
|
||||
- `LY_KEY_ENTER` Apply the selected option (Sends `LV_EVENT_VALUE_CHANGED` event and closes the drop-down list).
|
||||
|
||||
Learn more about [Keys](/overview/indev).
|
||||
|
||||
|
||||
@@ -7,20 +7,20 @@
|
||||
|
||||
## Overview
|
||||
|
||||
Images are the basic object to display images from the flash (as arrays) or externally as files. Images can display symbols (`LV_SYMBOL_...`) too.
|
||||
Images are the basic object to display images from flash (as arrays) or from files. Images can display symbols (`LV_SYMBOL_...`) too.
|
||||
|
||||
Using the [Image decoder interface](/overview/image.html#image-decoder) custom image formats can be supported as well.
|
||||
|
||||
## Parts and Styles
|
||||
- `LV_PART_MAIN` A background rectangle that uses the typical background style proeprties and the image itself using teh image style proeprties.
|
||||
- `LV_PART_MAIN` A background rectangle that uses the typical background style properties and the image itself using the image style properties.
|
||||
|
||||
## Usage
|
||||
|
||||
### Image source
|
||||
To provide maximum flexibility, the source of the image can be:
|
||||
|
||||
- a variable in the code (a C array with the pixels).
|
||||
- a file stored externally (like on an SD card).
|
||||
- a variable in code (a C array with the pixels).
|
||||
- a file stored externally (e.g. on an SD card).
|
||||
- a text with [Symbols](/overview/font).
|
||||
|
||||
To set the source of an image, use `lv_img_set_src(img, src)`.
|
||||
@@ -32,8 +32,7 @@ To use external files, you also need to convert the image files using the online
|
||||
You also need to use LVGL's file system module and register a driver with some functions for the basic file operation. Go to the [File system](/overview/file-system) to learn more.
|
||||
To set an image sourced from a file, use `lv_img_set_src(img, "S:folder1/my_img.bin")`.
|
||||
|
||||
You can set a symbol similarly to [Labels](/widgets/core/label). In this case, the image will be rendered as text according to the *font* specified in the style. It enables to use of light-weighted mono-color
|
||||
"letters" instead of real images. You can set symbol like `lv_img_set_src(img1, LV_SYMBOL_OK)`.
|
||||
You can also set a symbol similarly to [Labels](/widgets/core/label). In this case, the image will be rendered as text according to the *font* specified in the style. It enables to use of light-weight monochrome "letters" instead of real images. You can set symbol like `lv_img_set_src(img1, LV_SYMBOL_OK)`.
|
||||
|
||||
### Label as an image
|
||||
Images and labels are sometimes used to convey the same thing. For example, to describe what a button does.
|
||||
@@ -43,35 +42,35 @@ Therefore, images and labels are somewhat interchangeable, that is the images ca
|
||||
### Transparency
|
||||
The internal (variable) and external images support 2 transparency handling methods:
|
||||
|
||||
- **Chrome keying** - Pixels with `LV_COLOR_CHROMA_KEY` (*lv_conf.h*) color will be transparent.
|
||||
- **Chroma-keying** - Pixels with `LV_COLOR_CHROMA_KEY` (*lv_conf.h*) color will be transparent.
|
||||
- **Alpha byte** - An alpha byte is added to every pixel that contains the pixel's opacity
|
||||
|
||||
### Palette and Alpha index
|
||||
Besides *True color* (RGB) color format, the following formats are also supported:
|
||||
Besides the *True color* (RGB) color format, the following formats are supported:
|
||||
- **Indexed** - Image has a palette.
|
||||
- **Alpha indexed** - Only alpha values are stored.
|
||||
|
||||
These options can be selected in the image converter. To learn more about the color formats, read the [Images](/overview/image) section.
|
||||
|
||||
### Recolor
|
||||
A color can be mixed to every pixel of an image with a given intensity.
|
||||
It is very useful to show different states (checked, inactive, pressed, etc.) of an image without storing more versions of the same image.
|
||||
A color can be mixed with every pixel of an image with a given intensity.
|
||||
This can be useful to show different states (checked, inactive, pressed, etc.) of an image without storing more versions of the same image.
|
||||
This feature can be enabled in the style by setting `img_recolor_opa` between `LV_OPA_TRANSP` (no recolor, value: 0) and `LV_OPA_COVER` (full recolor, value: 255).
|
||||
The default value is `LV_OPA_TRANSP` so this feature is disabled.
|
||||
|
||||
The color to mix is set by `img_recolor`.
|
||||
|
||||
### Auto-size
|
||||
Is the width or height of the image object is set to `LV_SIZE_CONTENT` the obejct's size will be set according to the size of image source in the respective direction.
|
||||
If the width or height of the image object is set to `LV_SIZE_CONTENT` the object's size will be set according to the size of the image source in the respective direction.
|
||||
|
||||
### Mosaic
|
||||
If the object's size is greater than the image size in any directions, then the image will be repeated like a mosaic.
|
||||
It's a very useful feature to create a large image from only a very narrow source.
|
||||
This allows creation a large image from only a very narrow source.
|
||||
For example, you can have a *300 x 5* image with a special gradient and set it as a wallpaper using the mosaic feature.
|
||||
|
||||
### Offset
|
||||
With `lv_img_set_offset_x(img, x_ofs)` and `lv_img_set_offset_y(img, y_ofs)`, you can add some offset to the displayed image.
|
||||
It is useful if the object size is smaller than the image source size.
|
||||
Useful if the object size is smaller than the image source size.
|
||||
Using the offset parameter a [Texture atlas](https://en.wikipedia.org/wiki/Texture_atlas) or a "running image" effect can be created by [Animating](/overview/animation) the x or y offset.
|
||||
|
||||
## Transformations
|
||||
@@ -82,19 +81,19 @@ Fractional scale works as well. E.g. `281` for 10% enlargement.
|
||||
|
||||
To rotate the image use `lv_img_set_angle(img, angle)`. Angle has 0.1 degree precision, so for 45.8° set 458.
|
||||
|
||||
The `transform_zoom` and `transform_angle` style proeprties are also used to determin the final zoom and angle.
|
||||
The `transform_zoom` and `transform_angle` style properties are also used to determine the final zoom and angle.
|
||||
|
||||
By default, the pivot point of the rotation is the center of the image. It can be changed with `lv_img_set_pivot(img, pivot_x, pivot_y)`. `0;0` is the top left corner.
|
||||
|
||||
The quality of the transformation can be adjusted with `lv_img_set_antialias(img, true/false)`. With enabled anti-aliasing the transformations has a higher quality but they are slower.
|
||||
The quality of the transformation can be adjusted with `lv_img_set_antialias(img, true/false)`. With enabled anti-aliasing the transformations are higher quality but slower.
|
||||
|
||||
The transformations require the whole image to be available. Therefore indexed images (`LV_IMG_CF_INDEXED_...`), alpha only images (`LV_IMG_CF_ALPHA_...`) or images from files can not be transformed.
|
||||
In other words transformations work only on true color images stored as C array, or if a custom [Image decoder](/overview/images#image-edecoder) returns the whole image.
|
||||
|
||||
Note that, the real coordinates of image object won't change during transformation. That is `lv_obj_get_width/height/x/y()` will returned the original, non-zoomed coordinates.
|
||||
Note that the real coordinates of image objects won't change during transformation. That is `lv_obj_get_width/height/x/y()` will return the original, non-zoomed coordinates.
|
||||
|
||||
## Events
|
||||
No special events are sendt by the imge objects.
|
||||
No special events are sent by image objects.
|
||||
|
||||
Learn more about [Events](/overview/event).
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ A label is the basic object type that is used to display text.
|
||||
|
||||
### Set text
|
||||
You can set the text on a label at runtime with `lv_label_set_text(label, "New text")`.
|
||||
It will allocate a buffer dynamically, and the provided string will be copied into that buffer.
|
||||
This will allocate a buffer dynamically, and the provided string will be copied into that buffer.
|
||||
Therefore, you don't need to keep the text you pass to `lv_label_set_text` in scope after that function returns.
|
||||
|
||||
With `lv_label_set_text_fmt(label, "Value: %d", 15)` printf formatting can be used to set the text.
|
||||
@@ -26,15 +26,15 @@ In this case, the text is not stored in the dynamic memory and the given buffer
|
||||
This means that the array can't be a local variable which goes out of scope when the function exits.
|
||||
Constant strings are safe to use with `lv_label_set_text_static` (except when used with `LV_LABEL_LONG_DOT`, as it modifies the buffer in-place), as they are stored in ROM memory, which is always accessible.
|
||||
|
||||
### New line
|
||||
### Newline
|
||||
|
||||
New line characters are handled automatically by the label object. You can use `\n` to make a line break. For example: `"line1\nline2\n\nline4"`
|
||||
Newline characters are handled automatically by the label object. You can use `\n` to make a line break. For example: `"line1\nline2\n\nline4"`
|
||||
|
||||
### Long modes
|
||||
By default, the width and height of the label is set to `LV_SIZE_CONTENT`therefore the size of the label is automatically expands to the text size.
|
||||
Otherwise, if the width or height is explicitly set (useing e.g.`lv_obj_set_width` or a layout), the lines wider than the label's width can be manipulated according to several long mode policies.
|
||||
By default, the width and height of the label is set to `LV_SIZE_CONTENT`. Therefore the size of the label is automatically expanded to the text size.
|
||||
Otherwise, if the width or height are explicitly set (useing e.g.`lv_obj_set_width` or a layout), the lines wider than the label's width can be manipulated according to several long mode policies.
|
||||
Similary, the policies can be applied if the height of the text is greater than the height of the label.
|
||||
- `LV_LABEL_LONG_WRAP` Wrap too long lines. If the height is `LV_SIZE_CONTENT` the label's height will be expanded, elst the text will be clipped. (Default)
|
||||
- `LV_LABEL_LONG_WRAP` Wrap too long lines. If the height is `LV_SIZE_CONTENT` the label's height will be expanded, otherwise the text will be clipped. (Default)
|
||||
- `LV_LABEL_LONG_DOT` Replaces the last 3 characters from bottom right corner of the label with dots (`.`)
|
||||
- `LV_LABEL_LONG_SCROLL` If the text is wider than the label scroll it horizontally back and forth. If it's higher, scroll vertically. Only one direction is scrolled and horizontal scrolling has higher precedence.
|
||||
- `LV_LABEL_LONG_SCROLL_CIRCULAR` If the text is wider than the label scroll it horizontally continously. If it's higher, scroll vertically. Only one direction is scrolled and horizontal scrolling has higher precedence.
|
||||
@@ -52,17 +52,17 @@ This feature can be enabled individually for each label by `lv_label_set_recolor
|
||||
|
||||
### Text selection
|
||||
If enabled by `LV_LABEL_TEXT_SELECTION` part of the text can be selected. It's similar when on PC a you use your mouse to select a text.
|
||||
The whole mechanzim (click and select the text as you drag your finger/mouse) is implemeted in [Text area](/widgets/core/textarea) and the Label widget allows only to manually make parts of the text selected with
|
||||
The whole mechanism (click and select the text as you drag your finger/mouse) is implemented in [Text area](/widgets/core/textarea) and the Label widget only allows manual text selection with
|
||||
`lv_label_get_text_selection_start(label, start_char_index)` and `lv_label_get_text_selection_start(label, end_char_index)`.
|
||||
|
||||
### Very long texts
|
||||
LVGL can efficiently handle very long (e.g. > 40k characters) by saving some extra data (~12 bytes) to speed up drawing. To enable this feature, set `LV_LABEL_LONG_TXT_HINT 1` in `lv_conf.h`.
|
||||
LVGL can efficiently handle very long (e.g. > 40k characters) labels by saving some extra data (~12 bytes) to speed up drawing. To enable this feature, set `LV_LABEL_LONG_TXT_HINT 1` in `lv_conf.h`.
|
||||
|
||||
### Symbols
|
||||
The labels can display symbols alongside letters (or on their own). Read the [Font](/overview/font) section to learn more about the symbols.
|
||||
|
||||
## Events
|
||||
No special event's are send by the Label.
|
||||
No special events are sent by the Label.
|
||||
|
||||
Learn more about [Events](/overview/event).
|
||||
|
||||
|
||||
@@ -8,22 +8,19 @@
|
||||
The Line object is capable of drawing straight lines between a set of points.
|
||||
|
||||
## Parts and Styles
|
||||
- `LV_PART_MAIN` It uses all the typical backgrund properties and the line style properties.
|
||||
- `LV_PART_MAIN` uses all the typical background properties and line style properties.
|
||||
|
||||
## Usage
|
||||
|
||||
### Set points
|
||||
The points has to be stored in an `lv_point_t` array and passed to the object by the `lv_line_set_points(lines, point_array, point_cnt)` function.
|
||||
The points have to be stored in an `lv_point_t` array and passed to the object by the `lv_line_set_points(lines, point_array, point_cnt)` function.
|
||||
|
||||
### Auto-size
|
||||
By default the Line's width and height is set to `LV_SIZE_CONTENT` to automatically set its size to involve all the points.
|
||||
If the size if set explicitly the point out of the object
|
||||
It can be enable with the `lv_line_set_auto_size(line, true)` function.
|
||||
If enabled then when the points are set the object's width and height will be changed according to the maximal x and y coordinates among the points. The *auto size* is enabled by default.
|
||||
By default the Line's width and height are set to `LV_SIZE_CONTENT`. This means it will automatically set its size to fit all the points. If the size is set explicitly, parts on the line may not be visible.
|
||||
|
||||
### Invert y
|
||||
By deafult, the *y == 0* point is in the top of the object. It might be conter-intuitive in some cases so the y coordinates can be inverted with `lv_line_set_y_invert(line, true)`. In this case, *y == 0* will be the bottom of teh obejct.
|
||||
The *y invert* is disabled by default.
|
||||
By default, the *y == 0* point is in the top of the object. It might be conter-intuitive in some cases so the y coordinates can be inverted with `lv_line_set_y_invert(line, true)`. In this case, *y == 0* will be the bottom of the object.
|
||||
*y invert* is disabled by default.
|
||||
|
||||
## Events
|
||||
Only the [Generic events](../overview/event.html#generic-events) are sent by the object type.
|
||||
|
||||
@@ -6,26 +6,26 @@
|
||||
|
||||
## Overview
|
||||
|
||||
Roller allows you to simply select one option from more with scrolling.
|
||||
Roller allows you to simply select one option from a list by scrolling.
|
||||
|
||||
## Parts and Styles
|
||||
- `LV_PART_MAIN` The background of the roller that uses all the typical background properties and the text style properties. `style_text_line_space` adjusts the space between the options.
|
||||
When the Roller is scrolled and doesn't stop exactly on an option it will scroll to the nearest valid option automatically in `anim_time` milliseconds as it's specified in the style.
|
||||
- `LV_PART_MAIN` The background of the roller uses all the typical background properties and text style properties. `style_text_line_space` adjusts the space between the options.
|
||||
When the Roller is scrolled and doesn't stop exactly on an option it will scroll to the nearest valid option automatically in `anim_time` milliseconds as specified in the style.
|
||||
- `LV_PART_SELECTED` The selected option in the middle. Besides the typical background properties it uses the text style properties to change the appearance of the text in the selected area.
|
||||
|
||||
## Usage
|
||||
|
||||
### Set options
|
||||
The options are passed to the Roller as a string with `lv_roller_set_options(roller, options, LV_ROLLER_MODE_NORMAL/INFINITE)`. The options should be separated by `\n`. For example: `"First\nSecond\nThird"`.
|
||||
Options are passed to the Roller as a string with `lv_roller_set_options(roller, options, LV_ROLLER_MODE_NORMAL/INFINITE)`. The options should be separated by `\n`. For example: `"First\nSecond\nThird"`.
|
||||
|
||||
`LV_ROLLER_MODE_INFINITE` make the roller circular.
|
||||
`LV_ROLLER_MODE_INFINITE` makes the roller circular.
|
||||
|
||||
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 currently selected option use `lv_roller_get_selected(roller)` it will return the *index* of the selected option.
|
||||
The get the *index* of the currently selected option use `lv_roller_get_selected(roller)`.
|
||||
|
||||
`lv_roller_get_selected_str(roller, buf, buf_size)` copy the name of the selected option to `buf`.
|
||||
`lv_roller_get_selected_str(roller, buf, buf_size)` will copy the name of the selected option to `buf`.
|
||||
|
||||
### Visible rows
|
||||
The number of visible rows can be adjusted with `lv_roller_set_visible_row_count(roller, num)`.
|
||||
|
||||
@@ -6,20 +6,20 @@
|
||||
|
||||
## Overview
|
||||
|
||||
The Slider object looks like a [Bar](/widgets/core/bar) supplemented with a knob. The knob can be dragged to set a value. The Slider also can be vertical or horizontal.
|
||||
The Slider object looks like a [Bar](/widgets/core/bar) supplemented with a knob. The knob can be dragged to set a value. Just like Bar, Slider can be vertical or horizontal.
|
||||
|
||||
|
||||
## Parts and Styles
|
||||
- `LV_PART_MAIN` The background of the slider and it uses all the typical background style properties. `padding` makes the indicator smaller in the respective direction.
|
||||
- `LV_PART_INDICATOR` The indicator the show the current state of the slider. Also uses all the typical background style properties.
|
||||
- `LV_PART_KNOB` A rectangle (or circle) drawn at the current value. It also uses all the typical background properties to describe the knob(s). By default the knob is square (with a optional radius) with side length equal to the smaller side of the slider. The knob can be made larger with the `padding` values. Padding values can be asymmetric too.
|
||||
- `LV_PART_MAIN` The background of the slider. Uses all the typical background style properties. `padding` makes the indicator smaller in the respective direction.
|
||||
- `LV_PART_INDICATOR` The indicator that shows the current state of the slider. Also uses all the typical background style properties.
|
||||
- `LV_PART_KNOB` A rectangle (or circle) drawn at the current value. Also uses all the typical background properties to describe the knob(s). By default the knob is square (with a optional corner radius) with side length equal to the smaller side of the slider. The knob can be made larger with the `padding` values. Padding values can be asymmetric too.
|
||||
|
||||
## Usage
|
||||
|
||||
### Value and range
|
||||
To set an initial value use `lv_slider_set_value(slider, new_value, LV_ANIM_ON/OFF)`. The animation time is set by the styles' `anim_time` property.
|
||||
|
||||
To specify the range (min, max values) the `lv_slider_set_range(slider, min , max)` can be used.
|
||||
To specify the range (min, max values), `lv_slider_set_range(slider, min , max)` can be used.
|
||||
|
||||
### Modes
|
||||
The slider can be one the following modes:
|
||||
@@ -30,14 +30,12 @@ The slider can be one the following modes:
|
||||
The mode can be changed with `lv_slider_set_mode(slider, LV_SLIDER_MODE_...)`
|
||||
|
||||
### Knob-only mode
|
||||
Normally, the slider can be adjusted either by dragging the knob, or clicking on the slider bar.
|
||||
In the latter case the knob moves to the point clicked and slider value changes accordingly. In some cases it is desirable to set the slider to react on dragging the knob only.
|
||||
|
||||
This feature is enabled by adding the `LV_OBJ_FLAG_ADV_HITTEST`: `lv_obj_add_flag(slider, LV_OBJ_FLAG_ADV_HITTEST)`.
|
||||
Normally, the slider can be adjusted either by dragging the knob, or by clicking on the slider bar.
|
||||
In the latter case the knob moves to the point clicked and slider value changes accordingly. In some cases it is desirable to set the slider to react on dragging the knob only. This feature is enabled by adding the `LV_OBJ_FLAG_ADV_HITTEST`: `lv_obj_add_flag(slider, LV_OBJ_FLAG_ADV_HITTEST)`.
|
||||
|
||||
## Events
|
||||
- `LV_EVENT_VALUE_CHANGED` Sent while the slider is being dragged or changed with keys.
|
||||
The event is sent continuously while the slider is dragged and only when it is released. Use `lv_slider_is_dragged` to decide whether is slider is being dragged or just released.
|
||||
The event is sent continuously while the slider is dragged and once when released. Use `lv_slider_is_dragged` to detemine whether the Slider is still being dragged or has just been released.
|
||||
|
||||
Learn more about [Events](/overview/event).
|
||||
## Keys
|
||||
|
||||
@@ -7,18 +7,18 @@
|
||||
|
||||
## Overview
|
||||
|
||||
The Switch can be used to turn on/off something. It looks like a little slider.
|
||||
The Switch looks like a little slider and can be used to turn something on and off.
|
||||
|
||||
|
||||
## Parts and Styles
|
||||
- `LV_PART_MAIN` The background of the switch and it uses all the typical background style properties. `padding` makes the indicator smaller in the respective direction.
|
||||
- `LV_PART_INDICATOR` The indicator the show the current state of the switch. Also uses all the typical background style properties.
|
||||
- `LV_PART_KNOB` A rectangle (or circle) drawn at left or right side of teh indicator. It also uses all the typical background properties to describe the knob(s). By default the knob is square (with a optional radius) with side length equal to the smaller side of the slider. The knob can be made larger with the `padding` values. Padding values can be asymmetric too.
|
||||
- `LV_PART_MAIN` The background of the switch uses all the typical background style properties. `padding` makes the indicator smaller in the respective direction.
|
||||
- `LV_PART_INDICATOR` The indicator that shows the current state of the switch. Also uses all the typical background style properties.
|
||||
- `LV_PART_KNOB` A rectangle (or circle) drawn at left or right side of the indicator. Also uses all the typical background properties to describe the knob(s). By default the knob is square (with a optional corner radius) with side length equal to the smaller side of the slider. The knob can be made larger with the `padding` values. Padding values can be asymmetric too.
|
||||
|
||||
## Usage
|
||||
|
||||
### Change state
|
||||
When the switch is turned on it goes to `LV_STATE_CHACKED`. To get the current satte of the switch use `lv_obj_has_state(switch, LV_STATE_CHECHKED)`.
|
||||
When the switch is turned on it goes to `LV_STATE_CHECKED`. To get the current satte of the switch use `lv_obj_has_state(switch, LV_STATE_CHECKED)`.
|
||||
To manually turn the switch on/off call `lvobj_add/clear_state(switch, LV_STATE_CHECKED)`.
|
||||
|
||||
|
||||
|
||||
@@ -8,25 +8,25 @@
|
||||
|
||||
Tables, as usual, are built from rows, columns, and cells containing texts.
|
||||
|
||||
The Table object is very light weighted because only the texts are stored. No real objects are created for cells but they are just drawn on the fly.
|
||||
The Table object is very lightweight because only the texts are stored. No real objects are created for cells but they are just drawn on the fly.
|
||||
|
||||
|
||||
## Parts and Styles
|
||||
- `LV_PART_MAIN` The background of the table and uses all the typical background style properties.
|
||||
- `LV_PART_ITEMS` The cells of the table and they also use all the typical background style properties and the text properties.
|
||||
- `LV_PART_MAIN` The background of the table uses all the typical background style properties.
|
||||
- `LV_PART_ITEMS` The cells of the table also use all the typical background style properties and the text properties.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
### Set cell value
|
||||
|
||||
The cells can store only texts so numbers needs to be converted to text before displaying them in a table.
|
||||
The cells can store only text so numbers need to be converted to text before displaying them in a table.
|
||||
|
||||
`lv_table_set_cell_value(table, row, col, "Content")`. The text is saved by the table so it can be even a local variable.
|
||||
|
||||
Line break can be used in the text like `"Value\n60.3"`.
|
||||
Line breaks can be used in the text like `"Value\n60.3"`.
|
||||
|
||||
The new rows and column are automatically added is required
|
||||
New rows and columns are automatically added is required
|
||||
|
||||
### Rows and Columns
|
||||
|
||||
@@ -40,18 +40,18 @@ The height is calculated automatically from the cell styles (font, padding etc)
|
||||
|
||||
### Merge cells
|
||||
|
||||
Cells can be merged horizontally with `lv_table_set_cell_merge_right(table, col, row, true)`. To merge more adjacent cells apply this function for each cell.
|
||||
Cells can be merged horizontally with `lv_table_set_cell_merge_right(table, col, row, true)`. To merge more adjacent cells call this function for each cell.
|
||||
|
||||
### Scroll
|
||||
If the label's width or height is set to `LV_SIZE_CONTENT` that size will be se to show the whole table in the respective direction.
|
||||
If the label's width or height is set to `LV_SIZE_CONTENT` that size will be used to show the whole table in the respective direction.
|
||||
E.g. `lv_obj_set_size(table, LV_SIZE_CONTENT, LV_SIZE_CONTENT)` automatically sets the table size to show all the columns and rows.
|
||||
|
||||
If the width or height is set to smaller number than the "intrinsic" size then the table becomes scrollable.
|
||||
If the width or height is set to a smaller number than the "intrinsic" size then the table becomes scrollable.
|
||||
|
||||
## Events
|
||||
- `LV_EVENT_DRAW_PART_BEGIN` and `LV_EVENT_DRAW_PART_END` are sent for both main and items parts to allow hooking the drawing.
|
||||
The for more detail on the main part see the [Base object](/widgets/obj#events)'s documentation.
|
||||
For the items (sells) the following fields are used: `clip_area`, `draw_area`, `part`, `rect_dsc`, `label_dsc` `id` (current row × col count + current column).
|
||||
For more detail on the main part see the [Base object](/widgets/obj#events)'s documentation.
|
||||
For the items (cells) the following fields are used: `clip_area`, `draw_area`, `part`, `rect_dsc`, `label_dsc` `id` (current row × col count + current column).
|
||||
|
||||
|
||||
Learn more about [Events](/overview/event).
|
||||
|
||||
@@ -13,13 +13,13 @@ Long lines are wrapped and when the text becomes long enough the Text area can b
|
||||
One line mode and password modes are supported.
|
||||
|
||||
## Parts and Styles
|
||||
- `LV_PART_MAIN` The background of the text area and it uses all the typical backgrond style properties and the text related style properties including `text_align` to align the text to the left, right or center.
|
||||
- `LV_PART_MAIN` The background of the text area. Uses all the typical backgrond style properties and the text related style properties including `text_align` to align the text to the left, right or center.
|
||||
- `LV_PART_SCROLLBAR` The scrollbar that is shown when the text is too long.
|
||||
- `LV_PART_SELECTED` Tells the style of the [selected text](#text-selection). Only `text_color` and `bg_color` style properties can be used.
|
||||
- `LV_PART_SELECTED` Detemines the style of the [selected text](#text-selection). Only `text_color` and `bg_color` style properties can be used.
|
||||
- `LV_PART_CURSOR` Marks the position where the characters are inserted. The cursor's area is always the bounding box of the current character.
|
||||
A block cursor can be created by adding a background color and background opacity to `LV_PART_CURSOR`'s style. The create line cursor let the cursor transparent and set a left border.
|
||||
The `anim_time` style property sets the cursors blink time.
|
||||
- `LV_PART_TEXTAREA_PLACEHOLDER` It's a part related only to the text area and allows styling the placeholder text.
|
||||
A block cursor can be created by adding a background color and background opacity to `LV_PART_CURSOR`'s style. The create line cursor leave the cursor transparent and set a left border.
|
||||
The `anim_time` style property sets the cursor's blink time.
|
||||
- `LV_PART_TEXTAREA_PLACEHOLDER` Unique to Text Area, allows styling the placeholder text.
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -58,11 +58,11 @@ You can step the cursor with
|
||||
If `lv_textarea_set_cursor_click_pos(textarea, true)` is applied the cursor will jump to the position where the Text area was clicked.
|
||||
|
||||
### Hide the cursor
|
||||
The cursor is always visible, hiwever it can be good idea to style to be visible only in `LV_STATE_FOCUSED` state.
|
||||
The cursor is always visible, however it can be a good idea to style it to be visible only in `LV_STATE_FOCUSED` state.
|
||||
|
||||
### One line mode
|
||||
The Text area can be configures to be one lined with `lv_textarea_set_one_line(textarea, true)`.
|
||||
In this mode the height is set automatically to show only one line, line break character are ignored, and word wrap is disabled.
|
||||
The Text area can be configured to be on a single line with `lv_textarea_set_one_line(textarea, true)`.
|
||||
In this mode the height is set automatically to show only one line, line break characters are ignored, and word wrap is disabled.
|
||||
|
||||
### Password mode
|
||||
The text area supports password mode which can be enabled with `lv_textarea_set_password_mode(textarea, true)`.
|
||||
@@ -70,7 +70,7 @@ The text area supports password mode which can be enabled with `lv_textarea_set_
|
||||
If the `•` ([Bullet, U+2022](http://www.fileformat.info/info/unicode/char/2022/index.htm)) character exists in the font, the entered characters are converted to it after some time or when a new character is entered.
|
||||
If `•` not exists, `*` will be used.
|
||||
|
||||
In password mode `lv_textarea_get_text(textarea)` gives the real text, not the bullet characters.
|
||||
In password mode `lv_textarea_get_text(textarea)` returns the actual text entered, not the bullet characters.
|
||||
|
||||
The visibility time can be adjusted with `LV_TEXTAREA_DEF_PWD_SHOW_TIME)` in `lv_conf.h`.
|
||||
|
||||
@@ -82,19 +82,19 @@ Other characters will be ignored.
|
||||
The maximum number of characters can be limited with `lv_textarea_set_max_length(textarea, max_char_num)`
|
||||
|
||||
### Very long texts
|
||||
If there is a very long text in the Text area (e. g. > 20k characters) its scrolling and drawing might be slow.
|
||||
If there is a very long text in the Text area (e. g. > 20k characters), scrolling and drawing might be slow.
|
||||
However, by enabling `LV_LABEL_LONG_TXT_HINT 1` in `lv_conf.h` the performance can be hugely improved.
|
||||
It will save some information about the label to speed up its drawing.
|
||||
This will save some additional information about the label to speed up its drawing.
|
||||
Using `LV_LABEL_LONG_TXT_HINT` the scrolling and drawing will as fast as with "normal" short texts.
|
||||
|
||||
### Select text
|
||||
A part of text can be selected if enabled with `lv_textarea_set_text_selection(textarea, true)`.
|
||||
It works like when you select a text on your PC with your mouse.
|
||||
Any part of the text can be selected if enabled with `lv_textarea_set_text_selection(textarea, true)`.
|
||||
This works much like when you select text on your PC with your mouse.
|
||||
|
||||
## Events
|
||||
- `LV_EVENT_INSERT` Sent when before a character or text is inserted.
|
||||
The event paramter is the text planned to be inserted. `lv_textarea_set_insert_replace(textarea, "New text")` replaces the text to insert.
|
||||
The new text can not be in a local variable which is destroyed when the event callback exists. `""` means do not insert anything.
|
||||
- `LV_EVENT_INSERT` Sent right before a character or text is inserted.
|
||||
The event paramter is the text about to be inserted. `lv_textarea_set_insert_replace(textarea, "New text")` replaces the text to insert.
|
||||
The new text cannot be in a local variable which is destroyed when the event callback exists. `""` means do not insert anything.
|
||||
- `LV_EVENT_VALUE_CHANGED` Sent when the content of the text area has been changed.
|
||||
- `LV_EVENT_APPLY` Sent when `LV_KEY_ENTER` is pressed (or(sent) to a one line text area.
|
||||
|
||||
|
||||
@@ -7,27 +7,27 @@
|
||||
## Overview
|
||||
|
||||
The Calendar object is a classic calendar which can:
|
||||
- can show the days of any month in a 7x7 matrix
|
||||
- show the days of any month in a 7x7 matrix
|
||||
- Show the name of the days
|
||||
- highlight the current day (today)
|
||||
- highlight any user-defined dates
|
||||
|
||||
The Calendar is added to the default group (if it is set). Besides the Calendar is an editable object to allow selecting and clicking the dates with encoder navigation too.
|
||||
The Calendar is added to the default group (if it is set). Calendar is an editable object which allow selecting and clicking the dates with encoder navigation too.
|
||||
|
||||
To make the Calendar flexible, by default it doesn't show the current year or month. Instead, there area external "headers" that can be attached to the calendar.
|
||||
To make the Calendar flexible, by default it doesn't show the current year or month. Instead, there are external "headers" that can be attached to the calendar.
|
||||
|
||||
## Parts and Styles
|
||||
The calendar object uses the [Button matrix](/widgets/core/btnmatrix) object under the hood to arrange the days into a matrix.
|
||||
- `LV_PART_MAIN` The background of the calendar. It uses all the background related style properties.
|
||||
- `LV_PART_ITEMS` Refers to the dates and day names. Button matrix control flags are set the to differentiate the buttons and a custom drawer event is added modify the properties of the buttons
|
||||
- `LV_PART_MAIN` The background of the calendar. Uses all the background related style properties.
|
||||
- `LV_PART_ITEMS` Refers to the dates and day names. Button matrix control flags are set to differentiate the buttons and a custom drawer event is added modify the properties of the buttons as follows:
|
||||
- day names have no border, no background and drawn with a gray color
|
||||
- days of the previous and next month have `LV_BTNMATRIX_CTRL_DISABLED` flag
|
||||
- today has a ticker border with the themes primary color
|
||||
- highlighted day have some opacity with the themes primary color.
|
||||
- today has a thicker border with the theme's primary color
|
||||
- highlighted days have some opacity with the theme's primary color.
|
||||
|
||||
## Usage
|
||||
|
||||
Some functions uses the `lv_calendar_date_t` type which is a structure with `year`, `month` and `day` fields.
|
||||
Some functions use the `lv_calendar_date_t` type which is a structure with `year`, `month` and `day` fields.
|
||||
|
||||
### Current date
|
||||
To set the current date (today), use the `lv_calendar_set_today_date(calendar, year, month, day)` function. `month` needs to be in 1..12 range and `day` in 1..31 range.
|
||||
@@ -37,17 +37,17 @@ To set the shown date, use `lv_calendar_set_shown_date(calendar, year, month)`;
|
||||
|
||||
### Highlighted days
|
||||
|
||||
The list of highlighted dates should be stored in a `lv_calendar_date_t` array loaded by `lv_calendar_set_highlighted_dates(calendar, highlighted_dates, date_num)`.
|
||||
Only the arrays pointer will be saved so the array should be a static or global variable.
|
||||
The list of highlighted dates should be stored in a `lv_calendar_date_t` array loaded by `lv_calendar_set_highlighted_dates(calendar, highlighted_dates, date_num)`.
|
||||
Only the array's pointer will be saved so the array should be a static or global variable.
|
||||
|
||||
### Name of the days
|
||||
The name of the days can be adjusted with `lv_calendar_set_day_names(calendar, day_names)` where `day_names` looks like `const char * day_names[7] = {"Su", "Mo", ...};`
|
||||
Only the pointer of the day names is saved so the elements should be static, global or constant variables.
|
||||
Only the pointer of the day names is saved so the elements should be static, global or constant variables.
|
||||
|
||||
## Events
|
||||
- `LV_EVENT_VALUE_CHANGED` Sent is a data is clicked. `lv_calendar_get_pressed_date(calendar, &date)` tells which day is currently being pressed. Returns `LV_RES_OK` if theres is valid pressed data, else `LV_RES_INV`.
|
||||
- `LV_EVENT_VALUE_CHANGED` Sent if a date is clicked. `lv_calendar_get_pressed_date(calendar, &date)` set `date` to the date currently being pressed. Returns `LV_RES_OK` if there is a valid pressed date, else `LV_RES_INV`.
|
||||
|
||||
Learn more about [vent](/overview/event).
|
||||
Learn more about [Events](/overview/event).
|
||||
|
||||
## Keys
|
||||
- `LV_KEY_RIGHT/UP/LEFT/RIGHT` To navigate among the buttons to dates
|
||||
@@ -63,7 +63,7 @@ Learn more about [Keys](/overview/indev).
|
||||
|
||||
|
||||
### Drop-down
|
||||
`lv_calendar_header_dropdown_create(parent, calendar)` creates a header that contains 2 drop-drown lists: one for the year and an other for the month.
|
||||
`lv_calendar_header_dropdown_create(parent, calendar)` creates a header that contains 2 drop-drown lists: one for the year and another for the month.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,10 +6,9 @@
|
||||
|
||||
## Overview
|
||||
|
||||
Charts are a basic object to visualize data points.
|
||||
They support *Line* charts (connect points with lines and/or draw points on them) and *Bar* charts.
|
||||
Charts are a basic object to visualize data points. Currently *Line* charts (connect points with lines and/or draw points on them) and *Bar* charts are supported.
|
||||
|
||||
Charts also support:
|
||||
Charts can have:
|
||||
- division lines
|
||||
- 2 y axis
|
||||
- axis ticks and texts on ticks
|
||||
@@ -17,13 +16,13 @@ Charts also support:
|
||||
- scrolling and zooming
|
||||
|
||||
## Parts and Styles
|
||||
- `LV_PART_MAIN` The background of the chart. It uses all the typical background related style properties and *line* properties for the division lines. *Padding* makes the series area smaller.
|
||||
- `LV_PART_MAIN` The background of the chart. Uses all the typical background and *line* (for the division lines) related style properties. *Padding* makes the series area smaller.
|
||||
- `LV_PART_SCROLLBAR` The scrollbar used if the chart is zoomed. See the [Base object](/widgets/obj)'s documentation for details.
|
||||
- `LV_PART_ITEMS` Refers to the line or bar series.
|
||||
- Line chart: The *line* properties are used by the lines. `width`, `height`, `bg_color` and `radius` is used to set the appearance of points.
|
||||
- Bar chart: The typical background properties are used to style the bars.
|
||||
- `LV_PART_INDICATOR` Refers to the points on line and scatter chart (small circles or squares).
|
||||
- `LV_PART_CURSOR` *Line* properties are used to style the cursors. `width`, `height`, `bg_color` and `radius` is used to set the appearance of points.
|
||||
- `LV_PART_CURSOR` *Line* properties are used to style the cursors. `width`, `height`, `bg_color` and `radius` are used to set the appearance of points.
|
||||
- `LV_PART_TICKS` *Line* and *Text* style properties are used to style the ticks
|
||||
|
||||
## Usage
|
||||
@@ -31,7 +30,7 @@ Charts also support:
|
||||
|
||||
### Chart type
|
||||
The following data display types exist:
|
||||
- `LV_CHART_TYPE_NONE` Do not display any data. It can be used to hide the series.
|
||||
- `LV_CHART_TYPE_NONE` Do not display any data. Can be used to hide the series.
|
||||
- `LV_CHART_TYPE_LINE` Draw lines between the data points and/or points (rectangles or circles) on the data points.
|
||||
- `LV_CHART_TYPE_BAR` - Draw bars.
|
||||
- `LV_CHART_TYPE_SCATTER` - X/Y chart drawing point's and lines between the points. .
|
||||
@@ -40,9 +39,8 @@ You can specify the display type with `lv_chart_set_type(chart, LV_CHART_TYPE_..
|
||||
|
||||
|
||||
### Data series
|
||||
You can add any number of series to the charts by `lv_chart_add_series(chart, color, axis)`.
|
||||
It allocates data for a `lv_chart_series_t` structure which contains the chosen `color` and an array for the data points.
|
||||
`axis` can ha the following values:
|
||||
You can add any number of series to the charts by `lv_chart_add_series(chart, color, axis)`. This will allocates a `lv_chart_series_t` structure which contains the chosen `color` and an array for the data points.
|
||||
`axis` can have the following values:
|
||||
- `LV_CHART_AXIS_PRIMARY_Y` Left axis
|
||||
- `LV_CHART_AXIS_SECONDARY_Y` Right axis
|
||||
- `LV_CHART_AXIS_PRIMARY_X` Bottom axis
|
||||
@@ -51,12 +49,12 @@ It allocates data for a `lv_chart_series_t` structure which contains the chosen
|
||||
|
||||
`axis` tells which axis's range should be used te scale the values.
|
||||
|
||||
With `lv_chart_set_ext_y_array(chart, ser, value_array)` makes the chart use an external array for the given series.
|
||||
`lv_chart_set_ext_y_array(chart, ser, value_array)` makes the chart use an external array for the given series.
|
||||
`value_array` should look like this: `lv_coord_t * value_array[num_points]`. The array size needs to be large enough to hold all the points of that series.
|
||||
The array's pointer will be saved in the chart so it needs to be global, static or dynamically allocated.
|
||||
Note: you should call `lv_chart_refresh(chart)` after the external data source has been updated, to update the chart.
|
||||
Note: you should call `lv_chart_refresh(chart)` after the external data source has been updated to update the chart.
|
||||
|
||||
The value array of a series can be get by `lv_chart_get_y_array(chart, ser)`. It can be use with `ext_array` or *normal array*s.
|
||||
The value array of a series can be obtained with `lv_chart_get_y_array(chart, ser)`, which can be used with `ext_array` or *normal array*s.
|
||||
|
||||
For `LV_CHART_TYPE_SCATTER` type `lv_chart_set_ext_x_array(chart, ser, value_array)` and `lv_chart_get_x_array(chart, ser)` can be used as well.
|
||||
|
||||
@@ -75,17 +73,17 @@ For `LV_CHART_TYPE_SCATTER` type `lv_chart_set_value_by_id2(chart, ser, id, val
|
||||
### Update modes
|
||||
`lv_chart_set_next_value` can behave in two ways depending on *update mode*:
|
||||
- `LV_CHART_UPDATE_MODE_SHIFT` Shift old data to the left and add the new one to the right.
|
||||
- `LV_CHART_UPDATE_MODE_CIRCULAR` - Circularly add the new data (Like an ECG diagram).
|
||||
- `LV_CHART_UPDATE_MODE_CIRCULAR` - Add the new data in circular fashion, like an ECG diagram).
|
||||
|
||||
The update mode can be changed with `lv_chart_set_update_mode(chart, LV_CHART_UPDATE_MODE_...)`.
|
||||
|
||||
### Number of points
|
||||
The number of points in the series can be modified by `lv_chart_set_point_count(chart, point_num)`. The default value is 10.
|
||||
Note: this also affects the number of points processed when an external buffer is assigned to a series. So you need to be sure the external array is large enough.
|
||||
Note: this also affects the number of points processed when an external buffer is assigned to a series, so you need to be sure the external array is large enough.
|
||||
|
||||
#### Handling large number of points
|
||||
On line charts if the number of points is greater than the pixels horizontally, the Chart will draw only vertical lines to make the drawing of large amount of data effective.
|
||||
If there are let's say 10 point a pixel, LVGL searches the smallest and the greatest value and draws a vertical lines between them. It ensures to not miss any peaks.
|
||||
If there are, let's say, 10 points to a pixel, LVGL searches the smallest and the largest value and draws a vertical lines between them to ensure no peaks are missed.
|
||||
|
||||
### Vertical range
|
||||
You can specify the minimum and maximum values in y-direction with `lv_chart_set_range(chart, axis, min, max)`.
|
||||
@@ -96,10 +94,10 @@ The value of the points will be scaled proportionally. The default range is: 0..
|
||||
### Division lines
|
||||
The number of horizontal and vertical division lines can be modified by `lv_chart_set_div_line_count(chart, hdiv_num, vdiv_num)`.
|
||||
The default settings are 3 horizontal and 5 vertical division lines.
|
||||
If the there is visible border on a side and there is not padding on that side the division line would be drawn on top the border, therefore on it won't be drawn.
|
||||
If there is a visible border on a side and no padding on that side, the division line would be drawn on top of the border and therefore it won't be drawn.
|
||||
|
||||
### Override default start point for series
|
||||
If you wish a plot to start from a point other than the default which is `point[0]` of the series, you can set an alternative
|
||||
If you want a plot to start from a point other than the default which is `point[0]` of the series, you can set an alternative
|
||||
index with the function `lv_chart_set_x_start_point(chart, ser, id)` where `id` is the new index position to start plotting from.
|
||||
|
||||
Note that `LV_CHART_UPDATE_MODE_SHIFT` also changes the `start_point`.
|
||||
@@ -115,7 +113,7 @@ Ticks and labels can be added to the axis with `lv_chart_set_axis_tick(chart, ax
|
||||
- `draw_size` extra size required to draw the tick and labels (start with 20 px and increase if the ticks/labels are clipped)
|
||||
|
||||
### Zoom
|
||||
The chart can be zoom independently in x and y directions with `lv_chart_set_zoom_x(chart, factor)` and `lv_chart_set_zoom_y(chart, factor)`.
|
||||
The chart can be zoomed independently in x and y directions with `lv_chart_set_zoom_x(chart, factor)` and `lv_chart_set_zoom_y(chart, factor)`.
|
||||
If `factor` is 256 there is no zoom. 512 means double zoom, etc. Fractional values are also possible but < 256 value is not allowed.
|
||||
|
||||
|
||||
@@ -125,20 +123,20 @@ A cursor can be added with `lv_chart_cursor_t * c1 = lv_chart_add_cursor(chart,
|
||||
The possible values of `dir` `LV_DIR_NONE/RIGHT/UP/LEFT/DOWN/HOR/VER/ALL` or their OR-ed values to tell in which direction(s) should the cursor be drawn.
|
||||
|
||||
`lv_chart_set_cursor_pos(chart, cursor, &point)` sets the position of the cursor.
|
||||
`pos` is a pointer to an `lv_point_t` variable. E.g. `lv_point_t point = {10, 20};`. If the chart is scrolled the cursor will remain on the same place.
|
||||
`pos` is a pointer to an `lv_point_t` variable. E.g. `lv_point_t point = {10, 20};`. If the chart is scrolled the cursor will remain in the same place.
|
||||
|
||||
`lv_chart_get_point_pos_by_id(chart, series, id, &point_out)` tells the coordinate of a given point. It's useful to place the cursor to given point.
|
||||
`lv_chart_get_point_pos_by_id(chart, series, id, &point_out)` gets the coordinate of a given point. It's useful to place the cursor at a given point.
|
||||
|
||||
`lv_chart_set_cursor_point(chart, cursor, series, point_id)` sticks the cursor the point. If the point's position changes (new value or scrolling) the cursor will move with the point.
|
||||
`lv_chart_set_cursor_point(chart, cursor, series, point_id)` sticks the cursor at a point. If the point's position changes (new value or scrolling) the cursor will move with the point.
|
||||
|
||||
## Events
|
||||
- `LV_EVENT_VALUE_CHANGED` Sent when a new point is clicked perssed. `lv_chart_get_pressed_point(chart)` returns the zero based index of the pressed point.
|
||||
- `LV_EVENT_DRAW_PART_BEGIN` and `LV_EVENT_DRAW_PART_END` are sent for multiple parts. The fields of `lv_obj_draw_part_dsc_t` is set as the followings:
|
||||
- `LV_EVENT_VALUE_CHANGED` Sent when a new point is clicked pressed. `lv_chart_get_pressed_point(chart)` returns the zero-based index of the pressed point.
|
||||
- `LV_EVENT_DRAW_PART_BEGIN` and `LV_EVENT_DRAW_PART_END` are sent for multiple parts. The fields of `lv_obj_draw_part_dsc_t` are set as follows:
|
||||
- `LV_PART_ITEMS` (the series)
|
||||
- *Line chart* `clip_area`, `id` (index of the point), `value` (value of `id`th point), `p1`, `p2` (points of the line), `draw_area` (area of the point), `line_dsc`, `rect_dsc`, `sub_part_ptr` (pointer to the series), `part`
|
||||
- *Bar chart* `clip_area`, `id` (index of the point), `value` (value of `id`th point), `draw_area` (area of the point), `rect_dsc`, `sub_part_ptr` (pointer to the series), `part`
|
||||
- `LV_PART_TICKS` (major tick lines and label) `clip_area`, `id` (axis), `value` (scaled value of the tick), `text` (`value` converted to decimal), `line_dsc`, `label_dsc`, `part`
|
||||
- `LV_PART_CURSOR` Te events are send for 3 times:
|
||||
- `LV_PART_CURSOR` These events are sent at three times:
|
||||
- vertical line `clip_area`, `p1`, `p2` (points of the line), `line_dsc`, `part`
|
||||
- horizontal line `clip_area`, `p1`, `p2` (points of the line), `line_dsc`, `part`
|
||||
- point `clip_area`, `draw_area` (points of the line), `rect_dsc`, `part`
|
||||
|
||||
@@ -5,10 +5,9 @@
|
||||
# Color wheel (lv_colorwheel)
|
||||
|
||||
## Overview
|
||||
As its name implies *Color wheel* allows to select color. The Hue, Saturation and Value of the color can be selected after each other.
|
||||
As its name implies *Color wheel* allows the user to select a color. The Hue, Saturation and Value of the color can be selected separately.
|
||||
|
||||
Long pressing the object, the color wheel will change to the next parameter of the color (hue, saturation or value).
|
||||
Besides, double click will reset the current parameter.
|
||||
Long pressing the object, the color wheel will change to the next parameter of the color (hue, saturation or value). A double click will reset the current parameter.
|
||||
|
||||
## Parts and Styles
|
||||
- `LV_PART_MAIN` Only `arc_width` is used to set the width of the color wheel
|
||||
@@ -28,7 +27,7 @@ The color can be set manually with `lv_colorwheel_set_hue/saturation/value(color
|
||||
|
||||
The current color mode can be manually selected with `lv_colorwheel_set_color_mode(colorwheel, LV_COLORWHEEL_MODE_HUE/SATURATION/VALUE)`.
|
||||
|
||||
The color mode be fixed (do not change with long press) using `lv_colorwheel_set_color_mode_fixed(colorwheel, true)`
|
||||
The color mode can be fixed (so as to not change with long press) using `lv_colorwheel_set_color_mode_fixed(colorwheel, true)`
|
||||
|
||||
## Events
|
||||
- `LV_EVENT_VALUE_CHANGED` Sent if a new color is selected.
|
||||
@@ -38,7 +37,7 @@ Learn more about [Events](/overview/event).
|
||||
## Keys
|
||||
- `LV_KEY_UP`, `LV_KEY_RIGHT` Increment the current parameter's value by 1
|
||||
- `LV_KEY_DOWN`, `LV_KEY_LEFT` Decrement the current parameter's by 1
|
||||
- `LV_KEY_ENTER` By long press the next mode will be shown. By double click the current parameter will be reset.
|
||||
- `LV_KEY_ENTER` A long press will show the next mode. Double click to reset the current parameter.
|
||||
|
||||
Learn more about [Keys](/overview/indev).
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ You can set a left, right and center image, and the center image will be repeate
|
||||
### Image sources
|
||||
To set the image in a state, use the `lv_imgbtn_set_src(imgbtn, LV_IMGBTN_STATE_..., src_left, src_center, src_right)`.
|
||||
|
||||
The image sources works the same as described in the [Image object](/widgets/core/img) except that, "Symbols" are not supported by the Image button.
|
||||
The image sources work the same as described in the [Image object](/widgets/core/img) except that "Symbols" are not supported by the Image button.
|
||||
Any of the sources can `NULL`.
|
||||
|
||||
The possible states are:
|
||||
@@ -31,7 +31,7 @@ The possible states are:
|
||||
- `LV_IMGBTN_STATE_CHECKED_PRESSED`
|
||||
- `LV_IMGBTN_STATE_CHECKED_DISABLED`
|
||||
|
||||
If you set the sources only in `LV_IMGBTN_STATE_RELEASED`, the sources will be used in other states too.
|
||||
If you set sources only in `LV_IMGBTN_STATE_RELEASED`, these sources will be used in other states too.
|
||||
If you set e.g. `LV_IMGBTN_STATE_PRESSED` they will be used in pressed state instead of the released images.
|
||||
|
||||
## Events
|
||||
|
||||
@@ -12,8 +12,8 @@ The Keyboard object is a special [Button matrix](/widgets/core/btnmatrix) with p
|
||||
|
||||
## Parts and Styles
|
||||
Similarly to Button matrices Keyboards consist of 2 part:
|
||||
- `LV_PART_MAIN` The main part and uses all the typical background properties
|
||||
- `LV_PART_ITEMS` The buttons and it also uses all typical background properties and the *text* properties.
|
||||
- `LV_PART_MAIN` The main part. Uses all the typical background properties
|
||||
- `LV_PART_ITEMS` The buttons. Also uses all typical background properties as well as the *text* properties.
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -36,7 +36,7 @@ To assign the text area, use `lv_keyboard_set_textarea(kb, ta)`.
|
||||
### New Keymap
|
||||
You can specify a new map (layout) for the keyboard with `lv_keyboard_set_map(kb, map)` and `lv_keyboard_set_ctrl_map(kb, ctrl_map)`.
|
||||
Learn more about the [Button matrix](/widgets/core/btnmatrix) object.
|
||||
Keep in mind that, using following keywords will have the same effect as with the original map:
|
||||
Keep in mind that using following keywords will have the same effect as with the original map:
|
||||
- `LV_SYMBOL_OK` Apply.
|
||||
- `LV_SYMBOL_CLOSE` or `LV_SYMBOL_KEYBOARD` Close.
|
||||
- `LV_SYMBOL_BACKSPACE` Delete on the left.
|
||||
@@ -52,9 +52,7 @@ Keep in mind that, using following keywords will have the same effect as with th
|
||||
- `LV_EVENT_READY` - The *Ok* button is clicked.
|
||||
- `LV_EVENT_CANCEL` - The *Close* button is clicked.
|
||||
|
||||
The keyboard has a **default event handler** callback called `lv_keyboard_def_event_cb`.
|
||||
It handles the button pressing, map changing, the assigned text area, etc.
|
||||
You can remove it and replace it with a custom event handler if you wish.
|
||||
The keyboard has a **default event handler** callback called `lv_keyboard_def_event_cb`, which handles the button pressing, map changing, the assigned text area, etc. You can remove it and replace it with a custom event handler if you wish.
|
||||
|
||||
Learn more about [Events](/overview/event).
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
## Overview
|
||||
|
||||
The LEDs are rectangle-like (or circle) object. It's brightness can be adjusted. With lower brightness the the colors of the LED become darker.
|
||||
The LEDs are rectangle-like (or circle) object whose brightness can be adjusted. With lower brightness the colors of the LED become darker.
|
||||
|
||||
## Parts and Styles
|
||||
The LEDs have only one main part, called `LV_LED_PART_MAIN` and it uses all the typical background style properties.
|
||||
|
||||
@@ -8,23 +8,23 @@
|
||||
The Meter widget can visualize data in very flexible ways. In can show arcs, needles, ticks lines and labels.
|
||||
|
||||
## Parts and Styles
|
||||
- `LV_PART_MAIN` The background of the Meter and it uses the typical background properties.
|
||||
- `LV_PART_MAIN` The background of the Meter. Uses the typical background properties.
|
||||
- `LV_PART_TICK` The tick lines a labels using the *line* and *text* style properties.
|
||||
- `LV_PART_INDICATOR` The needle line or image using the *line* and *img* style properties, plus the background properties to draw a square (or circle) on the pivot of the needles. Padding makes the square larger.
|
||||
- `LV_PART_INDICATOR` The needle line or image using the *line* and *img* style properties, as well as the background properties to draw a square (or circle) on the pivot of the needles. Padding makes the square larger.
|
||||
- `LV_PART_ITEMS` The arcs using the *arc* properties.
|
||||
|
||||
## Usage
|
||||
|
||||
### Add a scale
|
||||
|
||||
For first a *Scale* needs to be added to the Meter with `lv_meter_scale_t * scale = lv_meter_add_scale(meter)`.
|
||||
The Scale has minor and major ticks and labels on the major tick. Later indicators (needles, arcs, tick modifiers) can be added to the meter
|
||||
First a *Scale* needs to be added to the Meter with `lv_meter_scale_t * scale = lv_meter_add_scale(meter)`.
|
||||
The Scale has minor and major ticks and labels on the major ticks. Later indicators (needles, arcs, tick modifiers) can be added to the meter
|
||||
|
||||
Any number of scaled can be added to Meter.
|
||||
Any number of scales can be added to Meter.
|
||||
|
||||
The minor tick lines can be configured with: `lv_meter_set_scale_ticks(meter, scale, tick_count, line_width, tick_length, ctick_olor)`.
|
||||
|
||||
To add major tick lines use `lv_meter_set_scale_major_ticks(meter, scale, nth_major, tick_width, tick_length, tick_color, label_gap)`. `nth_major` tells how many minor ticks to skip to draw a major tick.
|
||||
To add major tick lines use `lv_meter_set_scale_major_ticks(meter, scale, nth_major, tick_width, tick_length, tick_color, label_gap)`. `nth_major` to specify how many minor ticks to skip to draw a major tick.
|
||||
|
||||
Labels are added automatically on major ticks with `label_gap` distance from the ticks with text proportionally to the values of the tick line.
|
||||
|
||||
@@ -34,7 +34,7 @@ Labels are added automatically on major ticks with `label_gap` distance from the
|
||||
|
||||
Indicators needs to be added to a Scale and their value is interpreted in the range of the Scale.
|
||||
|
||||
All the indicator add functions returns `lv_meter_indicator_t *`.
|
||||
All the indicator add functions return `lv_meter_indicator_t *`.
|
||||
|
||||
#### Needle line
|
||||
|
||||
@@ -57,7 +57,7 @@ All the indicator add functions returns `lv_meter_indicator_t *`.
|
||||
#### Scale lines (ticks)
|
||||
`indic = lv_meter_add_scale_lines(meter, scale, color_start, color_end, local, width_mod)` adds an indicator that modifies the ticks lines.
|
||||
If `local` is `true` the ticks' color will be faded from `color_start` to `color_end` in the indicator's start and end value range.
|
||||
If `local` is `false` `color_start` and `color_end` is mapped to the start and end value of the scale and only a "slice" of that color gradient will be visible in the indicator's start and end value range.
|
||||
If `local` is `false` `color_start` and `color_end` will be mapped to the start and end value of the scale and only a "slice" of that color gradient will be visible in the indicator's start and end value range.
|
||||
`width_mod` modifies the width of the tick lines.
|
||||
|
||||
`lv_meter_set_indicator_start_value(meter, inidicator, value)` and `lv_meter_set_indicator_end_value(meter, inidicator, value)` sets the value of the indicator.
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
The Message boxes act as pop-ups.
|
||||
They are built from a background container, a title, an optional close button, a text and optional buttons.
|
||||
|
||||
The text will be broken into multiple lines automatically and the height will be set automatically to involve the text and the buttons.
|
||||
The text will be broken into multiple lines automatically and the height will be set automatically to include the text and the buttons.
|
||||
|
||||
The message box can be a modal (block clicks on the rest of the screen) or not modal.
|
||||
The message box can be modal (blocking clicks on the rest of the screen) or not modal.
|
||||
|
||||
## Parts and Styles
|
||||
The mesasge box is built from other widgets so you can check these widget's documentation for details.
|
||||
@@ -21,16 +21,16 @@ The mesasge box is built from other widgets so you can check these widget's docu
|
||||
|
||||
## Usage
|
||||
|
||||
### Create a messaeg box
|
||||
### Create a message box
|
||||
|
||||
`lv_msgbox_create(parent, title, txt, btn_txts[], add_close_btn)` creates a message box.
|
||||
|
||||
If `parent` is `NULL` the message box will be a modal. `title` and `txt` are strings for the title and the text.
|
||||
If `parent` is `NULL` the message box will be modal. `title` and `txt` are strings for the title and the text.
|
||||
`btn_txts[]` is an array with the buttons' text. E.g. `const char * btn_txts[] = {"Ok", "Cancel", NULL}`.
|
||||
`add_colse_btn` can be `true` or `false` to add/don't add a close button.
|
||||
|
||||
### Get the parts
|
||||
The building block of the message box can be get with the following functions:
|
||||
The building blocks of the message box can be obtained using the following functions:
|
||||
```c
|
||||
lv_obj_t * lv_msgbox_get_title(lv_obj_t * mbox);
|
||||
lv_obj_t * lv_msgbox_get_close_btn(lv_obj_t * mbox);
|
||||
@@ -43,7 +43,7 @@ lv_obj_t * lv_msgbox_get_btns(lv_obj_t * mbox);
|
||||
|
||||
## Events
|
||||
- `LV_EVENT_VALUE_CHANGED` is sent by the buttons if one of them is clicked. `LV_OBJ_FLAG_EVENT_BUBBLE` is enabled on the buttons so you can add events to the message box itself.
|
||||
In the event `lv_event_get_target(e)` will give the button matrix, `lv_event_get_current_target(e)` will give the message box. `lv_msgbox_get_active_btn_text(msgbox)` can be used to get the text of the clicked button.
|
||||
In the event handler, `lv_event_get_target(e)` will return the button matrix and `lv_event_get_current_target(e)` will givreturn the message box. `lv_msgbox_get_active_btn_text(msgbox)` can be used to get the text of the clicked button.
|
||||
|
||||
Learn more about [Events](/overview/event).
|
||||
|
||||
|
||||
@@ -6,21 +6,21 @@
|
||||
|
||||
## 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 automatically organize text of different fonts, colors, and sizes into the spangroup obj.
|
||||
|
||||
## Parts and Styles
|
||||
- `LV_PART_MAIN` The spangroup has only the part.
|
||||
- `LV_PART_MAIN` The spangroup has only one part.
|
||||
|
||||
## Usage
|
||||
|
||||
### Set text and style
|
||||
|
||||
spangroup object uses span to describe text and text style. so, first we need to create `span` descriptor use function `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 modified text is the same as the normal style used, 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).
|
||||
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).
|
||||
|
||||
### Text align
|
||||
like label object, The spangroup can be one the following modes:
|
||||
like label object, the spangroup can be set to one the following modes:
|
||||
- `LV_TEXT_ALIGN_LEFT` Align text to left.
|
||||
- `LV_TEXT_ALIGN_CENTER` Align text to center.
|
||||
- `LV_TEXT_ALIGN_RIGHT` Align text to right.
|
||||
@@ -29,22 +29,22 @@ like label object, The spangroup can be one the following modes:
|
||||
use function `lv_spangroup_set_align(spangroup, LV_TEXT_ALIGN_CENTER)` to set text align.
|
||||
|
||||
### Modes
|
||||
The spangroup can be one the following modes:
|
||||
- `LV_SPAN_MODE_FIXED` fixed the obj size.
|
||||
- `LV_SPAN_MODE_EXPAND` Expand the object size to the text size. only one line.
|
||||
The spangroup can be set to one the following modes:
|
||||
- `LV_SPAN_MODE_FIXED` fixes the object size.
|
||||
- `LV_SPAN_MODE_EXPAND` Expand the object size to the text size but stay on a single line.
|
||||
- `LV_SPAN_MODE_BREAK` Keep width, break the too long lines and auto expand height.
|
||||
|
||||
use function `lv_spangroup_set_mode(spangroup, LV_SPAN_MODE_BREAK)` to set obj mode.
|
||||
Use `lv_spangroup_set_mode(spangroup, LV_SPAN_MODE_BREAK)` to set object mode.
|
||||
|
||||
### Overflow
|
||||
The spangroup can be one the following modes:
|
||||
- `LV_SPAN_OVERFLOW_CLIP` truncate the text at the limit of the area.
|
||||
- `LV_SPAN_OVERFLOW_ELLIPSIS` This mode value will display an ellipsis(`...`) when text overflow the area.
|
||||
The spangroup can be set to one the following modes:
|
||||
- `LV_SPAN_OVERFLOW_CLIP` truncates the text at the limit of the area.
|
||||
- `LV_SPAN_OVERFLOW_ELLIPSIS` will display an ellipsis(`...`) when text overflows the area.
|
||||
|
||||
use function `lv_spangroup_set_overflow(spangroup, LV_SPAN_OVERFLOW_CLIP)` to set obj Overflow.
|
||||
Use `lv_spangroup_set_overflow(spangroup, LV_SPAN_OVERFLOW_CLIP)` to set object overflow mode.
|
||||
|
||||
### first line indent
|
||||
use function `lv_spangroup_set_indent(spangroup, 20)` to set text indent of first line.
|
||||
Use `lv_spangroup_set_indent(spangroup, 20)` to set the indent of the first line, in pixels.
|
||||
|
||||
## Events
|
||||
No special events are sent by this widget.
|
||||
|
||||
@@ -9,7 +9,7 @@ The Spinbox contains a number as text which can be increased or decreased by *Ke
|
||||
Under the hood the Spinbox is a modified [Text area](/widgets/core/textarea).
|
||||
|
||||
## Parts and Styles
|
||||
The parts of the Spinbox are identiacl to the [Text area](/widgets/core/textarea).
|
||||
The parts of the Spinbox are identical to the [Text area](/widgets/core/textarea).
|
||||
|
||||
### Value, range and step
|
||||
`lv_spinbox_set_value(spinbox, 1234)` sets a new value on the Spinbox.
|
||||
@@ -18,16 +18,15 @@ The parts of the Spinbox are identiacl to the [Text area](/widgets/core/textarea
|
||||
|
||||
`lv_spinbox_set_range(spinbox, -1000, 2500)` sets a range. If the value is changed by `lv_spinbox_set_value`, by *Keys*,`lv_spinbox_increment/decrement` this range will be respected.
|
||||
|
||||
`lv_spinbox_set_step(spinbox, 100)` sets which digits to change on increment/decrement. Only 10^n values values can be set, and not for example 3.
|
||||
`lv_spinbox_set_step(spinbox, 100)` sets which digits to change on increment/decrement. Only multiples of ten can be set, and not for example 3.
|
||||
|
||||
### Format
|
||||
|
||||
`lv_spinbox_set_digit_format(spinbox, digit_count, separator_position)` sets the number format. `digit_count` is the number of digit excluding the decimal separator and the sign.
|
||||
`separator_position` is the number of digit before the decimal point. If 0, decimal point is not
|
||||
`lv_spinbox_set_digit_format(spinbox, digit_count, separator_position)` sets the number format. `digit_count` is the number of digits excluding the decimal separator and the sign.
|
||||
`separator_position` is the number of digits before the decimal point. If 0, no decimal point is displayed.
|
||||
|
||||
### Rollover
|
||||
`lv_spinbox_set_rollover(spinbox, true/false)` enables/disabled rolloiver mode. If the minimum or maximum values is reached with rollover the value will change to the other limit.
|
||||
If not enabled the value will be reamain at the minimum or maximum value.
|
||||
`lv_spinbox_set_rollover(spinbox, true/false)` enables/disabled rollover mode. If either the minimum or maximum value is reached with rollover enabled, the value will change to the other limit. If rollover is disabled the value will be remain at the minimum or maximum value.
|
||||
|
||||
## Events
|
||||
- `LV_EVENT_VALUE_CHANGED` Sent when the value has changed.
|
||||
|
||||
@@ -14,7 +14,7 @@ The parts are identical to the parts of [lv_arc](/widgets/core/arc).
|
||||
|
||||
### Create a spinner
|
||||
|
||||
To create spinner use `lv_spinner_create(parent, spin_time, arc_length)`. `spin time` set the spin time in milliseconds, `arc_length` sets the length of the spinning arc in degrees.
|
||||
To create a spinner use `lv_spinner_create(parent, spin_time, arc_length)`. `spin time` sets the spin time in milliseconds, `arc_length` sets the length of the spinning arc in degrees.
|
||||
|
||||
## Events
|
||||
No special events are sent the the Spinner.
|
||||
|
||||
@@ -8,18 +8,18 @@
|
||||
## Overview
|
||||
|
||||
The Tab view object can be used to organize content in tabs.
|
||||
The Tab view is built from other widgets like this:
|
||||
The Tab view is built from other widgets:
|
||||
- Main container: [lv_obj](/widgets/obj))
|
||||
- Tab buttons: [lv_btnmatrix](/widgets/core/btnmatrix)
|
||||
- Container for the tabs: [lv_obj](/widgets/obj)
|
||||
- Content of the tabs: [lv_obj](/widgets/obj)
|
||||
|
||||
The tab buttons can be positioned on the topn, bottom, left and right side of teh Tab view.
|
||||
The tab buttons can be positioned on the top, bottom, left and right side of the Tab view.
|
||||
|
||||
A new tab can be selected either clicking on a tab button or sliding horizontally on the content.
|
||||
A new tab can be selected either by clicking on a tab button or by sliding horizontally on the content.
|
||||
|
||||
## Parts and Styles
|
||||
There are no special parts on the Tab view but the `lv_obj` and `lv_btnnmatrix` widgets are used to build up the Tab view.
|
||||
There are no special parts on the Tab view but the `lv_obj` and `lv_btnnmatrix` widgets are used to create the Tab view.
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -30,7 +30,7 @@ There are no special parts on the Tab view but the `lv_obj` and `lv_btnnmatrix`
|
||||
|
||||
### Add tabs
|
||||
|
||||
New tabs can be added with `lv_tabview_add_tab(tabview, "Tab name")`. It will return with a pointer to an [lv_obj](/widgets/obj) object where the tab's content can be created.
|
||||
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.
|
||||
|
||||
### Change tab
|
||||
|
||||
@@ -41,7 +41,7 @@ To select a new tab you can:
|
||||
|
||||
### Get the parts
|
||||
|
||||
`lv_tabview_get_content(tabview)` return the container for the tabs, `lv_tabview_get_tab_btns(tabview)` returns the Tab buttons which is a [Button matrix](/widgets/core/btnmatrix).
|
||||
`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).
|
||||
|
||||
## Events
|
||||
- `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.
|
||||
@@ -50,7 +50,7 @@ Learn more about [Events](/overview/event).
|
||||
|
||||
## Keys
|
||||
|
||||
Keys have effect only on the tab buttons (Button matrix). You can add it manually to a group if required.
|
||||
Keys have effect only on the tab buttons (Button matrix). Add manually to a group if required.
|
||||
|
||||
Learn more about [Keys](/overview/indev).
|
||||
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
|
||||
## Overview
|
||||
|
||||
The Tile view is a container object where its elements (called *tiles*) can be arranged in a grid form.
|
||||
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.
|
||||
Any direction of swiping can be disabled on the tiles individually to not allow moving from tile to an other.
|
||||
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 it gives a user interface you might have seen on the smartwatches.
|
||||
If the Tile view is screen sized, the user interface resembles what you may have seen on smartwatches.
|
||||
|
||||
## Parts and Styles
|
||||
The Tile view is build from an [lv_obj](/widgets/obj) container and also [lv_obj](/widgets/obj) tiles.
|
||||
The Tile view is built from an [lv_obj](/widgets/obj) container and [lv_obj](/widgets/obj) tiles.
|
||||
|
||||
The parts and styles work the same as for [lv_obj](/widgets/obj).
|
||||
|
||||
@@ -22,7 +22,7 @@ The parts and styles work the same as for [lv_obj](/widgets/obj).
|
||||
### Add a tile
|
||||
|
||||
`lv_tileview_add_tile(tileview, row_id, col_id, dir)` creates a new tile on the `row_id`th row and `col_id`th column.
|
||||
`dir` can be `LV_DIR_LEFT/RIGHT/TOP/BOTTOM/HOR/VER/ALL` or OR-ed values to enable moving to the adjacent tiles into the given direction with swiping.
|
||||
`dir` can be `LV_DIR_LEFT/RIGHT/TOP/BOTTOM/HOR/VER/ALL` or OR-ed values to enable moving to the adjacent tiles into the given direction by swiping.
|
||||
|
||||
The returned value is an `lv_obj_t *` on which the content of the tab can be created.
|
||||
|
||||
@@ -31,7 +31,7 @@ The Tile view can scroll to a tile with `lv_obj_set_tile(tileview, tile_obj, LV_
|
||||
|
||||
|
||||
## Events
|
||||
- `LV_EVENT_VALUE_CHANGED` Sent when a new tile loaded either with scrolling. `lv_tileview_get_tile_act(tabview)` can be used to get current tile.
|
||||
- `LV_EVENT_VALUE_CHANGED` Sent when a new tile loaded by scrolling. `lv_tileview_get_tile_act(tabview)` can be used to get current tile.
|
||||
|
||||
## Keys
|
||||
*Keys* are not handled by the Tile view.
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
|
||||
## Overview
|
||||
|
||||
The Window is container-like objects built from a header with title and button and a content area.
|
||||
The Window is container-like object built from a header with title and buttons and a content area.
|
||||
|
||||
## Parts and Styles
|
||||
The Window is built from other widgets so you can check these widget's documentation for details:
|
||||
The Window is built from other widgets so you can check their documentation for details:
|
||||
- Background: [lv_obj](/widgets/obj)
|
||||
- Header on the background: [lv_obj](/widgets/obj)
|
||||
- Title on the header: [lv_label](/widgets/core/label)
|
||||
@@ -21,19 +21,19 @@ The Window is built from other widgets so you can check these widget's document
|
||||
|
||||
### Create a Window
|
||||
|
||||
`lv_win_create(parent, header_height)` creates a Window with am empty header.
|
||||
`lv_win_create(parent, header_height)` creates a Window with an empty header.
|
||||
|
||||
### Title and buttons
|
||||
|
||||
Any number of text's (but typically only one) can be added to the header with `lv_win_add_title(win, "The title")`.
|
||||
Any number of texts (but typically only one) can be added to the header with `lv_win_add_title(win, "The title")`.
|
||||
|
||||
Control buttons can be added to the window's header with `lv_win_add_btn_right(win, icon, btn_width)`. `icon` can be any image source, and `btn_width` is the width of the button.
|
||||
|
||||
The title and the buttons will be added in the order of the functions are called. So adding a button, a text and two other buttons will result in a button on the left, a title, ant 2 buttons on the right.
|
||||
The width of the title is set to take all the remaining space on the header. In other words it pushes the buttons to the right added after the title.
|
||||
The title and the buttons will be added in the order the functions are called. So adding a button, a text and two other buttons will result in a button on the left, a title, and 2 buttons on the right.
|
||||
The width of the title is set to take all the remaining space on the header. In other words: it pushes to the right all the buttons that are added after the title.
|
||||
|
||||
## Get the parts
|
||||
`lv_win_get_header(win)` return a pointer to the header, `lv_win_get_content(win)` returns a pointer to the content container to which the content of the window can be added.
|
||||
`lv_win_get_header(win)` returns a pointer to the header, `lv_win_get_content(win)` returns a pointer to the content container to which the content of the window can be added.
|
||||
|
||||
## Events
|
||||
No special events are sent by the windows, however events can be added manually to the return value of `lv_win_add_btn_right`.
|
||||
|
||||
@@ -15,23 +15,23 @@ The 'Base Object' implements the basic properties of widgets on a screen, such a
|
||||
|
||||
In object-oriented thinking, it is the base class from which all other objects in LVGL are inherited.
|
||||
|
||||
The functions and functionalities of Base object can be used with other widgets too. For example `lv_obj_set_width(slider, 100)`
|
||||
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 widgets. It nothing else than a rectangle. Or from the the HTML world it's like a `<div>`.
|
||||
The Base object can be directly used as a simple widget: it nothing else than a rectangle. In HTML terms, think of it as a `<div>`.
|
||||
|
||||
### Coordinates
|
||||
|
||||
Here only a small subset of cooridnate settings is described. To see all the features of LVGL (padding, cooridnates in styles, layouts, etc) visit the [Coordinates](/overview/coords) page.
|
||||
Only a small subset of coordinate settings is described here. To see all the features of LVGL (padding, coordinates in styles, layouts, etc) visit the [Coordinates](/overview/coords) page.
|
||||
|
||||
#### Size
|
||||
The object size can be modified on individual axes with `lv_obj_set_width(obj, new_width)` and `lv_obj_set_height(obj, new_height)`, or both axes can be modified at the same time with `lv_obj_set_size(obj, new_width, new_height)`.
|
||||
|
||||
#### Position
|
||||
You can set the x and y coordinates relative to the parent with `lv_obj_set_x(obj, new_x)` and `lv_obj_set_y(obj, new_y)`, or both at the same time with `lv_obj_set_pos(obj, new_x, new_y)`.
|
||||
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 it's parent with `lv_obj_set_align(obj, LV_ALIGN_...)`. After this every x and y settings will be ralitiev to the set alignment mode.
|
||||
For example a this will shift the object by 10;20 px fro mthe 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 ralitive to the set alignment mode.
|
||||
For example a 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,11 +40,11 @@ lv_obj_set_pos(obj, 10, 20);
|
||||
lv_obj_align(obj, LV_ALIGN_CENTER, 10, 20);
|
||||
```
|
||||
|
||||
To align an object to an other 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(text, image, LV_ALIGN_OUT_BOTTOM_MID, 0, 10)`.
|
||||
|
||||
The following align types exists:
|
||||
The following align types exist:
|
||||

|
||||
|
||||
|
||||
@@ -52,9 +52,9 @@ The following align types exists:
|
||||
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 firstly (youngest) created child
|
||||
- `1` get the secondly created child
|
||||
- `-1` get the lastly (youngest) craeted child
|
||||
- `0` get the child created first child
|
||||
- `1` get the child created second
|
||||
- `-1` get the child created last
|
||||
|
||||
The children can be iterated lke this
|
||||
```c
|
||||
@@ -65,14 +65,14 @@ for(i = 0; i < lv_obj_get_child_cnt(parent); i++) {
|
||||
}
|
||||
```
|
||||
|
||||
`lv_obj_get_child_id(obj)` tells the index of the object. That is how many younger children its parent has.
|
||||
`lv_obj_get_child_id(obj)` returns the index of the object. That is how many younger children its parent has.
|
||||
|
||||
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)`.
|
||||
|
||||
### 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.
|
||||
|
||||
If you have more display then it's important to know that these functions operate on the lastly created or the explicitly selected (with `lv_disp_set_default`) display.
|
||||
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.
|
||||
|
||||
To get an object's screen use the `lv_obj_get_screen(obj)` function.
|
||||
|
||||
@@ -86,12 +86,12 @@ Read the [Event overview](/overview/event) to learn more about the events.
|
||||
|
||||
|
||||
### Styles
|
||||
Be sure to read the [Style overview](/overview/style). Here or only the most essential functions are described.
|
||||
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`.
|
||||
|
||||
The Base object use `LV_PART_MAIN` style properties and `LV_PART_SCROLLBAR` with the typical backgroud style proeprties.
|
||||
The base objects use `LV_PART_MAIN` style properties and `LV_PART_SCROLLBAR` with the typical backgroud style properties.
|
||||
|
||||
|
||||
### Flags
|
||||
@@ -104,7 +104,7 @@ There are some attributes which can be enabled/disabled by `lv_obj_add/clear_fla
|
||||
- `LV_OBJ_FLAG_SCROLLABLE` Make the object scrollable
|
||||
- `LV_OBJ_FLAG_SCROLL_ELASTIC` Allow scrolling inside but with slower speed
|
||||
- `LV_OBJ_FLAG_SCROLL_MOMENTUM` Make the object scroll further when "thrown"
|
||||
- `LV_OBJ_FLAG_SCROLL_ONE`Allow scrolling only one snapable children
|
||||
- `LV_OBJ_FLAG_SCROLL_ONE` Allow scrolling only one snapable children
|
||||
- `LV_OBJ_FLAG_SCROLL_CHAIN` Allow propagating the scroll to a parent
|
||||
- `LV_OBJ_FLAG_SCROLL_ON_FOCUS` Automatically scroll object to make it visible when focused
|
||||
- `LV_OBJ_FLAG_SNAPABLE` If scroll snap is enabled on the parent it can snap to this object
|
||||
@@ -139,21 +139,21 @@ lv_obj_clear_flag(obj, LV_OBJ_FLAG_CLICKABLE);
|
||||
|
||||
Read the [Input devices overview](/overview/indev) to learn more about the *Groups*.
|
||||
|
||||
Once, an object is added to *group* with `lv_group_add_obj(group, obj)` the object's current group can be get with `lv_obj_get_group(obj)`.
|
||||
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.
|
||||
|
||||
`lv_obj_is_focused(obj)` tells if the object is currently focused on its group or not. If the object is not added to a group, `false` will be returned.
|
||||
`lv_obj_is_focused(obj)` returns if the object is currently focused on its group or not. If the object is not added to a group, `false` will be returned.
|
||||
|
||||
|
||||
### 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)`.
|
||||
|
||||
## Events
|
||||
- `LV_EVENT_VALUE_CHANGED` when the `LV_OBJ_FLAG_CHECKABLE` flag is enabled and the obejct clicked (on transition to/from the checked state)
|
||||
- `LV_EVENT_VALUE_CHANGED` when the `LV_OBJ_FLAG_CHECKABLE` flag is enabled and the object clicked (on transition to/from the checked state)
|
||||
|
||||
Learn more about [Events](/overview/event).
|
||||
|
||||
## Keys
|
||||
If `LV_OBJ_FLAG_CHECKABLE` is enabled `LV_KEY_RIGHT` and `LV_KEY_UP` makes the object checked, and `LV_KEY_LEFT` and `LV_KEY_DOWN` makes it unchecked.
|
||||
If `LV_OBJ_FLAG_CHECKABLE` is enabled `LV_KEY_RIGHT` and `LV_KEY_UP` make the object checked, and `LV_KEY_LEFT` and `LV_KEY_DOWN` make it unchecked.
|
||||
|
||||
|
||||
Learn more about [Keys](/overview/indev).
|
||||
|
||||
Reference in New Issue
Block a user