Lines Matching full:the
13 To create an input device on the :ref:`default_display`:
22 If you have multiple displays, you will need to ensure the Default Display is set
23 to the display your input device is "connected to" before making the above calls.
25 The ``type`` member can be:
30 - :cpp:enumerator:`LV_INDEV_TYPE_BUTTON`: external buttons virtually pressing the screen
33 report the current state of an input device to LVGL.
40 Input devices that can click points on the display belong to the POINTER
72 LV_IMAGE_DECLARE(mouse_cursor_icon); /* Declare the image source. */
77 Note that the cursor object should have
88 gestures to their parents so they can be detected on the Screen Widget in the
117 To prevent passing the gesture event to the parent from a Widget, use
123 :cpp:expr:`lv_indev_wait_release(lv_indev_active())` in the event handler to
133 When the user clicks somewhere and after that turns the rotary
134 the last clicked widget will be either scrolled or it's value will be incremented/decremented
137 As this behavior is tightly related to the last clicked widget, the crown support is
138 an extension of the pointer input device. Just set ``data->diff`` to the number of
139 turned steps and LVGL will automatically send the :cpp:enumerator:`LV_EVENT_ROTARY`
140 event or scroll the widget based on the ``editable`` flag in the widget's class.
141 Non-editable widgets are scrolled and for editable widgets the event is sent.
143 To get the steps in an event callback use ``int32_t diff = lv_event_get_rotary_diff(e)``
145 The rotary sensitivity can be adjusted on 2 levels:
147 1. in the input device by the ``indev->rotary_sensitivity`` element (1/256 unit), and
148 2. by the ``rotary_sensitivity`` style property in the widget (1/256 unit).
150 The final diff is calculated like this:
155 For example, if both the indev and widget sensitivity is set to 128 (0.5), the input
156 diff will be multiplied by 0.25. The value of the Widget will be incremented by that
157 value or the Widget will be scrolled that amount of pixels.
162 LVGL has the ability to recognize multi-touch gestures, when a gesture
163 is detected a ``LV_EVENT_GESTURE`` is passed to the object on which the
164 gesture occurred. Currently, only the pinch gesture is supported
167 To enable the multi-touch gesture recognition set the
168 ``LV_USE_GESTURE_RECOGNITION`` option in the ``lv_conf.h`` file.
173 The driver or application collects touch events until the indev read callback
174 is called. It is the responsibility of the driver to call
175 the gesture recognition function of the appropriate type. For example
178 After calling the gesture detection function, it's necessary to call
179 the ``lv_indev_set_gesture_data`` function to set the ``gesture_data``
180 and ``gesture_type`` fields of the structure ``lv_indev_data_t``
184 /* The recognizer keeps the state of the gesture */
187 /* An array that stores the collected touch events */
206 /* Set the gesture information, before returning to LVGL */
211 A touch event is represented by the ``lv_indev_touch_data_t`` structure, the fields
212 being 1:1 compatible with events emitted by the `libinput <https://wayland.freedesktop.org/libinput…
217 …any other event. First, setup a listener for the ``LV_EVENT_GESTURE`` event type by defining and s…
219 The state or scale of the pinch gesture can be retrieved by
220 calling the ``lv_event_get_pinch_scale`` and ``lv_indev_get_gesture_state`` from within the
224 the source tree ``examples/others/gestures/lv_example_gestures.c``
229 Full keyboards with all the letters or simple keypads with a few navigation buttons
230 belong in the keypad category.
232 You can fully control the user interface without a touchpad or mouse by using a
233 keypad or encoder. It works similar to the *TAB* key on the PC to select an element
242 - Assign the group to an input device: :cpp:expr:`lv_indev_set_group(indev, g)`.
243 - Use ``LV_KEY_...`` to navigate among the Widgets in the group. See
244 ``lv_core/lv_group.h`` for the available keys.
253 data->key = last_key(); /* Get the last pressed or released key */
263 A common example of an encoder is a device with a turning knob that tells the hosting
264 device *when* the knob is being turned, and *in which direction*.
266 With an encoder your application can receive events from the following:
273 In short, the Encoder input devices work like this:
275 - By turning the encoder you can focus on the next/previous object.
276 - When you press the encoder on a simple object (like a button), it will be clicked.
277 - If you press the encoder on a complex object (like a list, message box, etc.)
278 the Widget will go to edit mode whereby you can navigate inside the
279 object by turning the encoder.
280 - To leave edit mode, long press the button.
282 To use an Encoder (similar to the *Keypads*) the Widgets should be added to a group.
306 In each group there is exactly one object with focus which receives the pressed keys
307 or the encoder actions. For example, if a :ref:`Text Area <lv_textarea>` has focus
308 and you press some letter on a keyboard, the keys will be sent and inserted into the
309 text area. Similarly, if a :ref:`Slider <lv_slider>` has focus and you press the
310 left or right arrows, the slider's value will be changed.
317 a Widget to the group use :cpp:expr:`lv_group_add_obj(g, widget)`.
323 If the Widget is not part of a group, this function will return ``false``.
341 - :cpp:enumerator:`LV_KEY_RIGHT`: Increase value or move to the right
342 - :cpp:enumerator:`LV_KEY_LEFT`: Decrease value or move to the left
344 - :cpp:enumerator:`LV_KEY_DEL`: Delete (e.g. a character on the right in a :ref:`Text Area <lv_text…
345 - :cpp:enumerator:`LV_KEY_BACKSPACE`: Delete (e.g. a character on the left in a :ref:`Text Area <lv…
346 - :cpp:enumerator:`LV_KEY_HOME`: Go to the beginning/top (e.g. in a :ref:`Text Area <lv_textarea>`)
347 - :cpp:enumerator:`LV_KEY_END`: Go to the end (e.g. in a :ref:`Text Area <lv_textarea>`)
349 The most important special keys in your :cpp:func:`read_cb` function are:
372 and edit them using the keypad. But encoders have a limited number of
373 "keys" and hence it is difficult to navigate using the default options.
378 :cpp:enumerator:`LV_KEY_NEXT` or :cpp:enumerator:`LV_KEY_PREV`. Therefore, the next or previous obj…
379 selected by turning the encoder. Pressing :cpp:enumerator:`LV_KEY_ENTER` will change
383 object. Depending on the Widget's type, a short or long press of
394 :cpp:expr:`lv_group_t * g = lv_group_create()` and set the default group with
397 Don't forget to assign one or more input devices to the default group
404 it with an encoder or keypad, it goes to the :cpp:enumerator:`LV_STATE_FOCUSED`
407 If a Widget switches to edit mode it enters the
426 - :cpp:enumerator:`LV_KEY_ENTER`: will simulate press or pushing of the encoder button.
429 - other keys will be passed to the focused widget.
431 If you hold the keys it will simulate an encoder advance with period
442 data->key = last_key(); /* Get the last pressed or released key */
456 A *Hardware Button* here is an external button (switch) typically next to the screen
457 which is assigned to specific coordinates of the screen. If a button is pressed it
458 will simulate the pressing on the assigned coordinate, similar to a touchpad.
476 static uint32_t last_btn = 0; /* Store the last pressed button */
477 int btn_pr = my_btn_read(); /* Get the ID (0,1,2...) of the pressed button */
479 last_btn = btn_pr; /* Save the ID of the pressed button */
480 data->state = LV_INDEV_STATE_PRESSED; /* Set the pressed state */
482 data->state = LV_INDEV_STATE_RELEASED; /* Set the released state */
485 data->btn_id = last_btn; /* Save the last button */
488 When the ``button_read`` callback in the example above changes the ``data->btn_id`` to ``0``
489 a press/release action at the first index of the ``points_array`` will be performed (``{12,30}``).
500 The default value of the following parameters can be changed in :cpp:type:`lv_indev_t`:
502 - ``scroll_limit`` Number of pixels to slide before actually scrolling the Widget
506 - ``read_timer`` pointer to the ``lv_timer`` which reads the input device. Its parameters
508 in ``lv_conf.h`` sets the default read period.
516 feedback for the user, e.g. to play a sound on :cpp:enumerator:`LV_EVENT_CLICKED`.
526 that buffers measured data. In ``read_cb`` you can report the buffered
527 data instead of directly reading the input device. Setting the
531 Switching the Input Device to Event-Driven Mode
536 need more control over when to read the input device. For example, you
543 /* Update the input device's running mode to LV_INDEV_MODE_EVENT */
548 /* Call this anywhere you want to read the input device */
551 …`, :cpp:func:`lv_timer_handler` and :cpp:func:`_lv_display_refr_timer` cannot run at the same time.