lv_spinbox.h

Defines

LV_SPINBOX_MAX_DIGIT_COUNT

Functions

lv_obj_t *lv_spinbox_create(lv_obj_t *parent)

Create a spinbox object

参数:

parent -- pointer to an object, it will be the parent of the new spinbox

返回:

pointer to the created spinbox

void lv_spinbox_set_value(lv_obj_t *obj, int32_t v)

Set spinbox value

参数:
  • obj -- pointer to spinbox

  • v -- value to be set

void lv_spinbox_set_rollover(lv_obj_t *obj, bool rollover)

Set spinbox rollover function

参数:
  • obj -- pointer to spinbox

  • rollover -- true or false to enable or disable (default)

void lv_spinbox_set_digit_format(lv_obj_t *obj, uint32_t digit_count, uint32_t sep_pos)

Set spinbox digit format (digit count and decimal format)

参数:
  • obj -- pointer to spinbox

  • digit_count -- number of digit excluding the decimal separator and the sign

  • sep_pos -- 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

参数:
  • 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

参数:
  • obj -- pointer to spinbox

  • range_min -- maximum value, inclusive

  • range_max -- minimum value, inclusive

void lv_spinbox_set_cursor_pos(lv_obj_t *obj, uint32_t pos)

Set cursor position to a specific digit for edition

参数:
  • 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

参数:
  • 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

参数:

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)

参数:

obj -- pointer to spinbox

返回:

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)

参数:

obj -- pointer to spinbox

返回:

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

参数:

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

参数:

obj -- pointer to spinbox

void lv_spinbox_increment(lv_obj_t *obj)

Increment spinbox value by one step

参数:

obj -- pointer to spinbox

void lv_spinbox_decrement(lv_obj_t *obj)

Decrement spinbox value by one step

参数:

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
uint32_t digit_count
uint32_t dec_point_pos
uint32_t rollover
uint32_t digit_step_dir