Text area entry using a keypad

Important: posts that do not use this template will be ignored or closed.

Before posting

  • Get familiar with Markdown to format and structure your post
  • Be sure to update lvgl from the latest version from the master branch.
  • Be sure you have checked the relevant part of the documentation. We will not respond in detail to posts where you haven’t read the relevant documentation.
  • If applicable use the Simulator to eliminate hardware related issues.

Delete this section if you read and applied the mentioned points.

Description

What MCU/Processor/Board and compiler are you using?

STM32L4R5VI

What LVGL version are you using?

7.1

What do you want to achieve?

I would like to be able to enter text into the text area using a keypad. Atm my keys are LV_KEY_PREV LV_KEY_NEXT (Up and down physical keys) and LV_KEY_UP / LV_KEY_DOWN (left and right physical keys). I don’t mind if it uses the onscreen keyboard but I have found that with my keys, it does not function correctly.

What have you tried so far?

Assigning the keyboard to the text area but with my keys I can only go up and down the keyboard. LV_KEY_NEXT / LV_KEY_PREV move to the next widget on the page.

Any pointers would be gratefully received.

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

/*You code here*/

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

Hi,

What is the intended way to “press” the selected key? It seems to me and “Enter” or “Ok” key is conceptually missing.

@kisvegabor

Thanks for the reply. I forgot to add that I have the enter key too.

I have solved this problem now by using a flag so that is set when the text area is clicked which then switches to a different set of keys that are suited to the keyboard widget.

My biggest challenge now is getting the text area to stay visible after the keyboard has opened as it covers over the text area.

Thanks

James

1 Like

I’m having this same issue. Are there any suggestions of how to keep the text area in focus on the scrollable window container, without manually having to scroll it after the keyboard has opened?

Take a look at lv_demo_widgets; you can programatically scroll the page to the text area’s location after you open the keyboard.

Thx embeddedt, that was exactly what I was looking for. As per the official docs:

Manual scroll and focus

To scroll the Window directly you can use lv_win_scroll_hor(win, dist_px) or lv_win_scroll_ver(win, dist_px) .

To make the Window show an object on it use lv_win_focus(win, child, LV_ANIM_ON/OFF) .

The time of scroll and focus animations can be adjusted with lv_win_set_anim_time(win, anim_time_ms)