App:Library:LVGL:docs:Widgets:Spinbox (lv spinbox)

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

https://docs.lvgl.io/8.2/widgets/extra/spinbox.html

Spinbox (lv_spinbox)

Overview

英文 自動翻訳

The Spinbox contains a number as text which can be increased or decreased by Keys or API functions. Under the hood the Spinbox is a modified Text area.

Spinboxには、キーまたはAPI関数によって増減できる数値がテキストとして含まれています。内部的には、Spinboxは変更されたテキスト領域です。
戻る : Previous


Parts and Styles

英文 自動翻訳

The parts of the Spinbox are identical to the Text area.

領域の各部分は、領域と同じです。
戻る : Previous


Value, range and step

英文 自動翻訳

lv_spinbox_set_value(spinbox, 1234) sets a new value on the Spinbox.

lv_spinbox_increment(spinbox) and lv_spinbox_decrement(spinbox) increments/decrements the value of the Spinbox according to the currently selected digit.

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 multiples of ten can be set, and not for example 3.

lv_spinbox_set_pos(spinbox, 1) sets the cursor to a specific digit to change on increment/decrement. For example position '0' sets the cursor to the least significant digit.

If an encoder is used as input device, the selected digit is shifted to the right by default whenever the encoder button is clicked. To change this behaviour to shifting to the left, the lv_spinbox_set_digit_step_direction(spinbox, LV_DIR_LEFT) can be used

lv_spinbox_set_value(spinbox, 1234)は、Spinboxに新しい値を設定します。

lv_spinbox_increment(spinbox)lv_spinbox_decrement(spinbox) は、現在選択されている桁に従ってSpinboxの値を増減します。


lv_spinbox_set_range(spinbox, -1000, 2500)は、範囲を設定します。

値がlv_spinbox_set_value、Keys、lv_spinbox_increment/decrementによって変更された場合、この範囲が尊重されます。


lv_spinbox_set_step(spinbox, 100)は、インクリメント/デクリメント時にどの桁を変更するかを設定します。10の倍数のみ設定可能で、例えば3は設定できません。


lv_spinbox_set_pos(spinbox, 1)は、インクリメント/デクリメント時に変更する特定の桁をカーソルに設定します。例えば、位置'0'はカーソルを最下位桁に設定します。


エンコーダを入力デバイスとして使用する場合、デフォルトでは、エンコーダボタンをクリックするたびに選択した桁が右にシフトします。この動作を左にシフトするように変更するには、lv_spinbox_set_digit_step_direction(spinbox, LV_DIR_LEFT)

戻る : Previous


Format

英文 自動翻訳

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.

lv_spinbox_set_digit_format(spinbox, digit_count, separator_position)は数値の書式を設定します。


digit_count は、小数点と符号を除く桁数です。


separator_position は、小数点の前の桁数です。


0の場合、小数点は表示されません。

戻る : Previous


Rollover

英文 自動翻訳

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 remain at the minimum or maximum value.

lv_spinbox_set_rollover(spinbox, true/false)ロールオーバーモードの有効/無効を設定します。


ロールオーバーが有効な状態で最小値または最大値のどちらかに達すると、値はもう一方の制限値に変わります。


ロールオーバーが無効の場合、値は最小値または最大値のままです。

戻る : Previous


Events

英文 自動翻訳
  • LV_EVENT_VALUE_CHANGED Sent when the value has changed.

See the events of the Text area too.

Learn more about Events.

  • LV_EVENT_VALUE_CHANGED 値が変更されたときに送信されます。 テキストエリアのイベントもご覧ください。 イベントについてはこちらをご覧ください。
戻る : Previous


Keys

英文 自動翻訳
  • LV_KEY_LEFT/RIGHT With Keypad move the cursor left/right. With Encoder decrement/increment the selected digit.
  • LV_KEY_UP/DOWN With Keypad and Encoder increment/decrement the value.
  • LV_KEY_ENTER With Encoder got the net digit. Jump to the first after the last.
  • LV_KEY_LEFT/RIGHT キーパッドでカーソルを左/右に移動します。エンコーダで選択された桁をデクリメント/インクリメントします。
  • LV_KEY_UP/DOWN キーパッドとエンコーダーで値をインクリメント/デクリメントします。
  • LV_KEY_ENTER エンコーダで正味の桁を取得します。最後の桁の後に最初の桁にジャンプします。
戻る : Previous


Example

英文 自動翻訳

Simple Spinbox

LVGL docs example 106.png

戻る : Previous


API

英文 自動翻訳

Functions

lv_obj_t *lv_spinbox_create(lv_obj_t *parent)

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

void lv_spinbox_set_value(lv_obj_t *obj, int32_t i)

Set spinbox value
Parameters
  • obj -- pointer to spinbox
  • i -- value to be set

void lv_spinbox_set_rollover(lv_obj_t *obj, bool b)

Set spinbox rollover function
Parameters
  • obj -- pointer to spinbox
  • b -- true or false to enable or disable (default)

void lv_spinbox_set_digit_format(lv_obj_t *obj, uint8_t digit_count, uint8_t separator_position)

Set spinbox digit format (digit count and decimal format)
Parameters
  • obj -- pointer to spinbox
  • digit_count -- number of digit excluding the decimal separator and the sign
  • separator_position -- number of digit before the decimal point. If 0, decimal point is not shown

void lv_spinbox_set_step(lv_obj_t *obj, uint32_t step)

Set spinbox step
Parameters
  • obj -- pointer to spinbox
  • step -- steps on increment/decrement. Can be 1, 10, 100, 1000, etc the digit that will change.

void lv_spinbox_set_range(lv_obj_t *obj, int32_t range_min, int32_t range_max)

Set spinbox value range
Parameters
  • obj -- pointer to spinbox
  • range_min -- maximum value, inclusive
  • range_max -- minimum value, inclusive

void lv_spinbox_set_pos(lv_obj_t *obj, uint8_t pos)

Set cursor position to a specific digit for edition
Parameters
  • obj -- pointer to spinbox
  • pos -- selected position in spinbox

void lv_spinbox_set_digit_step_direction(lv_obj_t *obj, lv_dir_t direction)

Set direction of digit step when clicking an encoder button while in editing mode
Parameters
  • obj -- pointer to spinbox
  • direction -- the direction (LV_DIR_RIGHT or LV_DIR_LEFT)

bool lv_spinbox_get_rollover(lv_obj_t *obj)

Get spinbox rollover function status
Parameters
obj -- pointer to spinbox

int32_t lv_spinbox_get_value(lv_obj_t *obj)

Get the spinbox numeral value (user has to convert to float according to its digit format)
Parameters
obj -- pointer to spinbox
Returns
value integer value of the spinbox

int32_t lv_spinbox_get_step(lv_obj_t *obj)

Get the spinbox step value (user has to convert to float according to its digit format)
Parameters
obj -- pointer to spinbox
Returns
value integer step value of the spinbox

void lv_spinbox_step_next(lv_obj_t *obj)

Select next lower digit for edition by dividing the step by 10
Parameters
obj -- pointer to spinbox

void lv_spinbox_step_prev(lv_obj_t *obj)

Select next higher digit for edition by multiplying the step by 10
Parameters
obj -- pointer to spinbox

void lv_spinbox_increment(lv_obj_t *obj)

Increment spinbox value by one step
Parameters
obj -- pointer to spinbox

void lv_spinbox_decrement(lv_obj_t *obj)

Decrement spinbox value by one step
Parameters
obj -- pointer to spinbox

Variables

const lv_obj_class_t lv_spinbox_class

struct lv_spinbox_t

Public Members
lv_textarea_t ta
int32_t value
int32_t range_max
int32_t range_min
int32_t step
uint16_t digit_count
uint16_t dec_point_pos
uint16_t rollover
uint16_t digit_step_dir
Functions

lv_obj_t *lv_spinbox_create(lv_obj_t *parent)

Spinboxオブジェクトの作成
Parameters
parent -- オブジェクトへのポインタを指定すると、それが新しいスピンボックスの親になります。
Returns
作成したスピンボックスへのポインタ

void lv_spinbox_set_value(lv_obj_t *obj, int32_t i)

スピンボックスの値を設定する
Parameters
  • obj -- スピンボックスへのポインタ
  • i -- 設定する値

void lv_spinbox_set_rollover(lv_obj_t *obj, bool b)

スピンボックスのロールオーバー機能を設定する
Parameters
  • obj -- スピンボックスへのポインタ
  • b -- true または false で有効または無効にします (デフォルト)。

void lv_spinbox_set_digit_format(lv_obj_t *obj, uint8_t digit_count, uint8_t separator_position)

スピンボックスの桁数の設定(桁数、小数点以下の桁数)。
Parameters
  • obj -- スピンボックスへのポインタ
  • digit_count -- 小数点以下と符号を除いた桁数
  • separator_position -- 小数点以下の桁数。0の場合、小数点は表示されません

void lv_spinbox_set_step(lv_obj_t *obj, uint32_t step)

スピンボックスのステップを設定する
Parameters
  • obj -- スピンボックスへのポインタ
  • step --増分/減分時のステップ。1、10、100、1000 など、変更する桁を指定できます。

void lv_spinbox_set_range(lv_obj_t *obj, int32_t range_min, int32_t range_max)

スピンボックスの値域を設定する
Parameters
  • obj -- スピンボックスへのポインタ
  • range_min -- 最大値
  • range_max -- 最小値

void lv_spinbox_set_pos(lv_obj_t *obj, uint8_t pos)

カーソル位置を特定の桁に設定し、版を作成する
Parameters
  • obj -- スピンボックスへのポインタ
  • pos -- スピンボックス内の選択位置

void lv_spinbox_set_digit_step_direction(lv_obj_t *obj, lv_dir_t direction)

編集モード時にエンコーダーボタンをクリックしたときの桁上げ方向の設定
Parameters
  • obj -- スピンボックスへのポインタ
  • direction -- 向き (LV_DIR_RIGHT or LV_DIR_LEFT)

bool lv_spinbox_get_rollover(lv_obj_t *obj)

スピンボックスのロールオーバー機能の状態を取得する
Parameters
obj -- スピンボックスへのポインタ

int32_t lv_spinbox_get_value(lv_obj_t *obj)

Get the spinbox numeral value (user has to convert to float according to its digit format)
Parameters
obj -- スピンボックスへのポインタ
Returns
value スピンボックスの整数値

int32_t lv_spinbox_get_step(lv_obj_t *obj)

スピンボックスのステップ値を取得します(ユーザはその桁数に応じてfloatに変換する必要があります)
Parameters
obj -- スピンボックスへのポインタ
Returns
value integer スピンボックスのステップ値

void lv_spinbox_step_next(lv_obj_t *obj)

ステップを10で割って、次の下位桁のエディションを選択します。
Parameters
obj -- スピンボックスへのポインタ

void lv_spinbox_step_prev(lv_obj_t *obj)

ステップを10倍して、次の上位桁のエディションを選択します。
Parameters
obj --スピンボックスへのポインタ

void lv_spinbox_increment(lv_obj_t *obj)

スピンボックスの値を1ステップ増加させる
Parameters
obj -- スピンボックスへのポインタ

void lv_spinbox_decrement(lv_obj_t *obj)

スピンボックスの値を1段階下げる
Parameters
obj -- スピンボックスへのポインタ

Variables

const lv_obj_class_t lv_spinbox_class

struct lv_spinbox_t

Public Members
lv_textarea_t ta
int32_t value
int32_t range_max
int32_t range_min
int32_t step
uint16_t digit_count
uint16_t dec_point_pos
uint16_t rollover
uint16_t digit_step_dir
戻る : Previous


Example

戻る : Previous