App:Library:LVGL:docs:Widgets:Roller (lv roller)

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

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

Roller (lv_roller)

Overview

英文 自動翻訳

Roller allows you to simply select one option from a list by scrolling.

ローラーでは、スクロールすることでリストから1つの選択肢を簡単に選ぶことができます。
戻る : Previous


Parts and Styles

英文 自動翻訳
  • 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.
  • LV_PART_MAIN ローラーの背景は、典型的な背景プロパティとテキストスタイルプロパティをすべて使用する。style_text_line_space はオプション間のスペースを調整する。ローラーがスクロールされ、オプションで正確に停止しない場合、スタイルで指定された anim_time ミリ秒以内に最も近い有効なオプションまで自動的にスクロールされます。
  • LV_PART_SELECTED 中間にある選択されたオプション。典型的な背景プロパティの他に、テキストスタイルプロパティを使用して、選択された領域のテキストの外観を変更する。
戻る : Previous


Usage

Set options

英文 自動翻訳

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 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.

オプションは lv_roller_set_options(roller, options, LV_ROLLER_MODE_NORMAL/INFINITE)で文字列として Roller に渡すことができる。


オプションは \nで区切ります。例えば "First\nSecond\nThird"のように。


LV_ROLLER_MODE_INFINITE はローラーを円形にします。

lv_roller_set_selected(roller, id, LV_ANIM_ON/OFF) , により手動でオプションを選択でき、id はオプションのインデックスである。

戻る : Previous


Get selected option

英文 自動翻訳

To get the index of the currently selected option use lv_roller_get_selected(roller).

lv_roller_get_selected_str(roller, buf, buf_size) will copy the name of the selected option to buf.

現在選択されているオプションのインデックスを取得するには、 lv_roller_get_selected(roller)を使用します。

lv_roller_get_selected_str(roller, buf, buf_size) は、選択されたオプションの名前を bufにコピーします。

戻る : Previous


Visible rows

英文 自動翻訳

The number of visible rows can be adjusted with lv_roller_set_visible_row_count(roller, num).

This function calculates the height with the current style. If the font, line space, border width, etc. of the roller changes this function needs to be called again.

可視行数は lv_roller_set_visible_row_count(roller, num) で調整可能である。

この関数は、現在のスタイルで高さを計算する。ローラのフォント、行間、ボーダー幅などを変更した場合、この関数を再度呼び出す必要がある。

戻る : Previous


Events

英文 自動翻訳
  • LV_EVENT_VALUE_CHANGED Sent when a new option is selected.


See the events of the Base object too.

Learn more about Events.

  • LV_EVENT_VALUE_CHANGED 新しいオプションが選択されたときに送られる。


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

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

戻る : Previous


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)
  • LV_KEY_RIGHT/DOWN 次のオプションを選択します。
  • LV_KEY_LEFT/UP 前のオプションを選択する
  • LY_KEY_ENTER 選択したオプションの適用 (LV_EVENT_VALUE_CHANGED イベントの送信)
戻る : Previous


Example

英文 自動翻訳

Simple Roller

LVGL docs example 099.png

Styling the roller

LVGL docs example 100.png

add fade mask to roller

LVGL docs example 101.png

戻る : Previous


API

英文 自動翻訳

Typedefs

typedef uint8_t lv_roller_mode_t

Enums

enum [anonymous]

Roller mode. Values:
enumerator LV_ROLLER_MODE_NORMAL
Normal mode (roller ends at the end of the options).
enumerator LV_ROLLER_MODE_INFINITE
Infinite mode (roller can be scrolled forever).

Functions

lv_obj_t *lv_roller_create(lv_obj_t *parent)

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

void lv_roller_set_options(lv_obj_t *obj, const char *options, lv_roller_mode_t mode)

Set the options on a roller
Parameters
  • obj -- pointer to roller object
  • options -- a string with ' ' separated options. E.g. "One\nTwo\nThree"
  • mode -- LV_ROLLER_MODE_NORMAL or LV_ROLLER_MODE_INFINITE

void lv_roller_set_selected(lv_obj_t *obj, uint16_t sel_opt, lv_anim_enable_t anim)

Set the selected option
Parameters
  • obj -- pointer to a roller object
  • sel_opt -- index of the selected option (0 ... number of option - 1);
  • anim_en -- LV_ANIM_ON: set with animation; LV_ANOM_OFF set immediately

void lv_roller_set_visible_row_count(lv_obj_t *obj, uint8_t row_cnt)

Set the height to show the given number of rows (options)
Parameters
  • obj -- pointer to a roller object
  • row_cnt -- number of desired visible rows

uint16_t lv_roller_get_selected(const lv_obj_t *obj)

Get the index of the selected option
Parameters
obj -- pointer to a roller object
Returns
index of the selected option (0 ... number of option - 1);

void lv_roller_get_selected_str(const lv_obj_t *obj, char *buf, uint32_t buf_size)

Get the current selected option as a string.
Parameters
  • obj -- pointer to ddlist object
  • buf -- pointer to an array to store the string
  • buf_size -- size of buf in bytes. 0: to ignore it.

const char *lv_roller_get_options(const lv_obj_t *obj)

Get the options of a roller
Parameters
obj -- pointer to roller object
Returns
the options separated by ' '-s (E.g. "Option1\nOption2\nOption3")

uint16_t lv_roller_get_option_cnt(const lv_obj_t *obj)

Get the total number of options
Parameters
obj -- pointer to a roller object
Returns
the total number of options

Variables

const lv_obj_class_t lv_roller_class

struct lv_roller_t

Public Members
lv_obj_t obj
uint16_t option_cnt
Number of options
uint16_t sel_opt_id
Index of the current option
uint16_t sel_opt_id_ori
Store the original index on focus
lv_roller_mode_t mode
uint32_t moved


Typedef

typedef uint8_t lv_roller_mode_t

列挙型

列挙型[匿名]

ローラーモード。 値:
列挙子LV_ROLLER_MODE_NORMAL
通常モード(ローラーはオプションの最後で終了します)。
列挙子LV_ROLLER_MODE_INFINITE
無限モード(ローラーは永久にスクロールできます)。

機能

lv_obj_t * lv_roller_create(lv_obj_t * parent)

ローラーオブジェクトを作成する
パラメーター
parent-オブジェクトへのポインタ。新しいローラーの親になります。
戻り値
作成されたローラーへのポインター

void lv_roller_set_options(lv_obj_t * obj、const char * options、lv_roller_mode_t mode)

ローラーにオプションを設定する
パラメーター
  • obj-ローラーオブジェクトへのポインター
  • options- ''で区切られたオプションを持つ文字列例:「1つ\n2つ\n3つ」
  • モード-LV_ROLLER_MODE_NORMALまたはLV_ROLLER_MODE_INFINITE

void lv_roller_set_selected(lv_obj_t * obj、uint16_t sel_opt、lv_anim_enable_t anim)

選択したオプションを設定します
パラメーター
  • obj-ローラーオブジェクトへのポインター
  • sel_opt-選択したオプションのインデックス(0 ...オプションの数-1);
  • anim_en --LV_ANIM_ON:アニメーションで設定; LV_ANOM_OFFはすぐに設定されます

void lv_roller_set_visible_row_count(lv_obj_t * obj、uint8_t row_cnt)

指定された行数を表示するように高さを設定します(オプション)
パラメーター
  • obj-ローラーオブジェクトへのポインター
  • row_cnt-表示される必要な行の数

uint16_t lv_roller_get_selected(const lv_obj_t * obj)

選択したオプションのインデックスを取得します
パラメーター
obj-ローラーオブジェクトへのポインター
戻り値
選択したオプションのインデックス(0 ...オプションの数-1);

void lv_roller_get_selected_str(const lv_obj_t * obj、char * buf、uint32_t buf_size)

現在選択されているオプションを文字列として取得します。
パラメーター
  • obj -ddlistオブジェクトへのポインタ
  • buf--文字列を格納する配列へのポインタ
  • buf_size-バイト単位のサイズbuf。0:無視します。

const char * lv_roller_get_options(const lv_obj_t * obj)

ローラーのオプションを取得する
パラメーター
obj-ローラーオブジェクトへのポインター
戻り値
'' -sで区切られたオプション(例: "Option1 \ nOption2 \ nOption3")

uint16_t lv_roller_get_option_cnt(const lv_obj_t * obj)

オプションの総数を取得する
パラメーター
obj-ローラーオブジェクトへのポインター
戻り値
オプションの総数

変数

const lv_obj_class_t lv_roller_class

struct lv_roller_t

パブリックメンバー
lv_obj_t obj
uint16_t option_cnt
オプションの数
uint16_t sel_opt_id
現在のオプションのインデックス
uint16_t sel_opt_id_ori
元のインデックスをフォーカスに保存
lv_roller_mode_tモード
uint32_tが移動しました


戻る : Previous