acid-drop

- Hacking the planet from a LilyGo T-Deck using custom firmware
git clone git://git.acid.vegas/acid-drop.git
Log | Files | Refs | Archive | README | LICENSE

spinbox.md (2674B)

      1 ```eval_rst
      2 .. include:: /header.rst
      3 :github_url: |github_link_base|/widgets/extra/spinbox.md
      4 ```
      5 # Spinbox (lv_spinbox)
      6 
      7 ## Overview
      8 The Spinbox contains a number as text which can be increased or decreased by *Keys* or API functions.
      9 Under the hood the Spinbox is a modified [Text area](/widgets/core/textarea).
     10 
     11 ## Parts and Styles
     12 The parts of the Spinbox are identical to the [Text area](/widgets/core/textarea).
     13 
     14 ### Value, range and step
     15 `lv_spinbox_set_value(spinbox, 1234)` sets a new value on the Spinbox.
     16 
     17 `lv_spinbox_increment(spinbox)` and `lv_spinbox_decrement(spinbox)` increments/decrements the value of the Spinbox according to the currently selected digit.
     18 
     19 `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.
     20 
     21 `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.
     22 
     23 `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.
     24 
     25 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
     26 
     27 ### Format
     28 
     29 `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.
     30 `separator_position` is the number of digits before the decimal point. If 0, no decimal point is displayed.
     31 
     32 ### Rollover
     33 `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.
     34 
     35 ## Events
     36 - `LV_EVENT_VALUE_CHANGED` Sent when the value has changed.
     37 
     38 See the events of the [Text area](/widgets/core/textarea) too.
     39 
     40 Learn more about [Events](/overview/event).
     41 
     42 ## Keys
     43 - `LV_KEY_LEFT/RIGHT` With *Keypad* move the cursor left/right. With *Encoder* decrement/increment the selected digit.
     44 - `LV_KEY_UP/DOWN` With *Keypad* and *Encoder* increment/decrement the value.
     45 - `LV_KEY_ENTER` With *Encoder* got the net digit. Jump to the first after the last.
     46 
     47 ## Example
     48 
     49 ```eval_rst
     50 
     51 .. include:: ../../../examples/widgets/spinbox/index.rst
     52 
     53 ```
     54 
     55 ## API
     56 
     57 ```eval_rst
     58 
     59 .. doxygenfile:: lv_spinbox.h
     60   :project: lvgl
     61 
     62 ```
     63 ## Example