App:Library:LVGL:docs:Widgets:Switch (lv switch)

提供: robot-jp wiki
ナビゲーションに移動検索に移動

https://docs.lvgl.io/8.2/widgets/core/arc.html

Switch (lv_switch)

Overview

英文 自動翻訳

The Switch looks like a little slider and can be used to turn something on and off.

スイッチは小さなスライダーのようなもので、何かをオンにしたりオフにしたりするのに使うことができます。
戻る : Previous


Parts and Styles

英文 自動翻訳
  • 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 an 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.
  • LV_PART_MAINスイッチの背景は、一般的な背景スタイルのプロパティをすべて使用します。padding は、インジケータをそれぞれの方向で小さくします。
  • LV_PART_INDICATOR スイッチの現在の状態を示すインジケータです。一般的な背景スタイルのプロパティをすべて使用します。
  • LV_PART_KNOB インジケー タ の左側または右側に描かれる矩形 (ま たは円)。また、ノブ(複数可)を記述するために、すべての典型的な背景のプロパティを使用します。デフォルトでは、ノブは正方形で(オプションで角の半径を設定)、スライダーの小さい方の辺と同じ長さです。ノブはpadding値で大きくすることができる。paddingの値は非対称にすることもできる。
戻る : Previous


Usage

Change state

英文 自動翻訳

The switch uses the standard LV_STATE_CHECKED state.

To get the current state of the switch (with true being on), use lv_obj_has_state(switch, LV_STATE_CHECKED).

Call lv_obj_add_state(switch, LV_STATE_CHECKED) to turn it on, or lv_obj_clear_state(switch, LV_STATE_CHECKED) to turn it off.

スイッチは標準的なLV_STATE_CHECKED ステートを使用します。

スイッチの現在の状態(true がオン)を取得するには、lv_obj_has_state(switch, LV_STATE_CHECKED)を使用します。

lv_obj_add_state(switch, LV_STATE_CHECKED)を呼んでオンにし、lv_obj_clear_state(switch, LV_STATE_CHECKED)を呼んでオフにすることが可能です。

戻る : Previous


Events

英文 自動翻訳
  • LV_EVENT_VALUE_CHANGED Sent when the switch changes state.


See the events of the Base object too.

Learn more about Events.

  • LV_EVENT_VALUE_CHANGED スイッチの状態が変化したときに送られる。


Baseオブジェクトのイベントも参照してください。

イベントの詳細を確認してください。

戻る : Previous


Keys

英文 自動翻訳
  • 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.

  • LV_KEY_UP/RIGHT スライダーをオンにします。
  • LV_KEY_DOWN/LEFT スライダーをオフにします。
  • LV_KEY_ENTER スイッチを切り替える


キーの詳細を確認してください。

戻る : Previous


Example

英文 自動翻訳

Simple Switch

LVGL docs example 108.png

戻る : Previous


API

英文 自動翻訳

Functions

lv_obj_t *lv_switch_create(lv_obj_t *parent)

Create a switch object
Parameters
parent -- pointer to an object, it will be the parent of the new switch
Returns
pointer to the created switch

Variables

const lv_obj_class_t lv_switch_class

struct lv_switch_t

Public Members
lv_obj_t obj
int32_t anim_state


Functions

lv_obj_t *lv_switch_create(lv_obj_t *parent)

Create a switch object
Parameters
parent -- オブジェクトへのポインタの場合、新しいスイッチの親になります。
Returns
pointer to the created switch

Variables

const lv_obj_class_t lv_switch_class

struct lv_switch_t

Public Members
lv_obj_t obj
int32_t anim_state


戻る : Previous