docs update some widgets to v8
This commit is contained in:
@@ -11,30 +11,26 @@ The Switch can be used to turn on/off something. It looks like a little slider.
|
||||
|
||||
|
||||
## 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.
|
||||
|
||||
The Switch uses the the following parts:
|
||||
- `LV_SWITCH_PART_BG`: main part
|
||||
- `LV_SWITCH_PART_INDIC`: the indicator (virtual part)
|
||||
- `LV_SWITCH_PART_KNOB`: the knob (virtual part)
|
||||
|
||||
The parts and style works the same as in case of [Slider](/widgets/slider). Read its documentation for a details description.
|
||||
|
||||
##Usage
|
||||
## Usage
|
||||
|
||||
### Change state
|
||||
The state of the Switch can be changed by clicking on it or by `lv_switch_on(switch, LV_ANIM_ON/OFF)`, `lv_switch_off(switch, LV_ANIM_ON/OFF)` or `lv_switch_toggle(switch, LV_ANOM_ON/OFF)` functions
|
||||
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)`.
|
||||
To manually turn the switch on/off call `lvobj_add/clear_state(switch, LV_STATE_CHECKED)`.
|
||||
|
||||
### Animation time
|
||||
|
||||
The time of animations, when the switch changes state, can be adjusted with `lv_switch_set_anim_time(switch, anim_time)`.
|
||||
|
||||
## Events
|
||||
Besides the [Generic events](../overview/event.html#generic-events) the following [Special events](../overview/event.html#special-events) are sent by the Switch:
|
||||
- **LV_EVENT_VALUE_CHANGED** Sent when the switch changes state.
|
||||
- `LV_EVENT_VALUE_CHANGED` Sent when the switch changes state.
|
||||
|
||||
Learn more about [Events](/overview/event).
|
||||
|
||||
## Keys
|
||||
- **LV_KEY_UP**, **LV_KEY_RIGHT** Turn on the slider
|
||||
- **LV_KEY_DOWN**, **LV_KEY_LEFT** Turn off the slider
|
||||
- `LV_KEY_UP/RIGHT` Turns on the slider
|
||||
- `LV_KEY_DOWN/LEFT` Turns off the slider
|
||||
- `LV_KEY_ENTER` Toggles the switch
|
||||
|
||||
Learn more about [Keys](/overview/indev).
|
||||
|
||||
@@ -42,11 +38,10 @@ Learn more about [Keys](/overview/indev).
|
||||
|
||||
```eval_rst
|
||||
|
||||
.. include:: /lv_examples/src/lv_ex_widgets/lv_ex_switch/index.rst
|
||||
.. include:: ../../../examples/widgets/lv_ex_switch/index.rst
|
||||
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
```eval_rst
|
||||
|
||||
Reference in New Issue
Block a user