[English]

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(微调框)包含了一串数字文本,可以通过 Keys 或 API 函数来 “增加” 或 “减少” 数字大小 。本质上微调框只是覆盖在 文本框 控件上面。

Parts and Styles(部分和样式)

显示原文

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


微调框的各个部分与 文本框 控件相同。

Value, range and step(值、范围和步长)

显示原文

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_cursor_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_digit_step_direction(spinbox, LV_DIR_LEFT) 设置

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. 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 是不包括小数分隔符和符号的位数,也就是小数点之前的位数。如果为0,则不显示小数点。

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) 启用/禁用 翻转模式。如果在启用翻转的情况下达到最小值或最大值,则该值将更改为其他限制。如果禁用了翻转,则该值将保持在最小值或最大值。

Events(事件)

显示原文

See the events of the Text area too.

Learn more about Events(事件).


另请参阅 文本区域 的事件。

详细了解更多 Events(事件)

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编码器 得到净数字。跳转到第一个之后在最后一个。

Example

API

lv_types.h

lv_spinbox.h