feat(btnmatrix/keyboard): add option to show popovers on button press (#2537)
This adds a new option that, when enabled, shows popovers when pressing buttons, similar to how the system keyboards on Android and iOS behave.
This commit is contained in:
@@ -36,8 +36,9 @@ In addition to the width, each button can be customized with the following param
|
||||
- `LV_BTNMATRIX_CTRL_NO_REPEAT` Disable repeating when the button is long pressed
|
||||
- `LV_BTNMATRIX_CTRL_DISABLED` Makes a button disabled Like `LV_STATE_DISABLED` on normal objects
|
||||
- `LV_BTNMATRIX_CTRL_CHECKABLE` Enable toggling of a button. I.e. `LV_STATE_CHECHED` will be added/removed as the button is clicked
|
||||
- `LV_BTNMATRIX_CTRL_CHECKED` MAke the button checked. It will use the `LV_STATE_CHECHKED` styles.
|
||||
- `LV_BTNMATRIX_CTRL_CLICK_TRIG` Enabled: send LV_EVENT_VALUE_CHANGE on CLICK, Disabled: send LV_EVENT_VALUE_CHANGE on PRESS*/
|
||||
- `LV_BTNMATRIX_CTRL_CHECKED` Make the button checked. It will use the `LV_STATE_CHECHKED` styles.
|
||||
- `LV_BTNMATRIX_CTRL_CLICK_TRIG` Enabled: send LV_EVENT_VALUE_CHANGE on CLICK, Disabled: send LV_EVENT_VALUE_CHANGE on PRESS
|
||||
- `LV_BTNMATRIX_CTRL_POPOVER` Show the button label in a popover when pressing this key
|
||||
- `LV_BTNMATRIX_CTRL_RECOLOR` Enable recoloring of button texts with `#`. E.g. `"It's #ff0000 red#"`
|
||||
- `LV_BTNMATRIX_CTRL_CUSTOM_1` Custom free to use flag
|
||||
- `LV_BTNMATRIX_CTRL_CUSTOM_2` Custom free to use flag
|
||||
|
||||
@@ -32,6 +32,12 @@ To set the mode manually, use `lv_keyboard_set_mode(kb, mode)`. The default mode
|
||||
You can assign a [Text area](/widgets/core/textarea) to the Keyboard to automatically put the clicked characters there.
|
||||
To assign the text area, use `lv_keyboard_set_textarea(kb, ta)`.
|
||||
|
||||
### Key Popovers
|
||||
To enable key popovers on press, like on common Android and iOS keyboards, use `lv_keyboard_set_popovers(kb, true)`. The default control maps are preconfigured to only show the popovers on keys that produce a symbol and not on e.g. space. If you use a custom keymap, set the `LV_BTNMATRIX_CTRL_POPOVER` flag for all keys that you want to show a popover.
|
||||
|
||||
Note that popovers for keys in the top row will draw outside the widget boundaries. To account for this, reserve extra free space on top of the keyboard or ensure that the keyboard is added _after_ any widgets adjacent to its top boundary so that the popovers can draw over those.
|
||||
|
||||
The popovers currently are merely a visual effect and don't allow selecting additional characters such as accents yet.
|
||||
|
||||
### New Keymap
|
||||
You can specify a new map (layout) for the keyboard with `lv_keyboard_set_map(kb, map)` and `lv_keyboard_set_ctrl_map(kb, ctrl_map)`.
|
||||
|
||||
Reference in New Issue
Block a user