I want to use keypad , But I don't know how to create a group, where to create it, I want to put the initialisation of the group in the loading process of each page, but I tried it and it doesn't work in simulation.
Hello @acd ,
In general, our keyboard is used with the textarea widget. You can put a textarea on the screen and select the keyboard option in the settings directory on the right, so when you use a textarea, it will automatically generate an event, that is, when you click on the target textarea, the keyboard will automatically pop up.
Specific keyboard usage can be found in keyboard.c in the lvgl\src\extra\widgets\keyboard folder of your project.
Best Regards
Liu
Thank you for your reply, but this answer is not what I need, my project uses multiple mechanical buttons, no touch screen, so when adding mechanical buttons to lvgl, I need to use the concept of keypad, this is different from the keyboard, keypad needs to be combined with the group, and then respond to the event, but I found that about these When adding custom code, it will result in the simulation doesn't work.
Hello @acd ,
Can I take it that you want to use mechanical keys to interact with the various widgets of the Lvgl library?
As far as I know, there is no way to change the generated files in simulation, which may require you to select a specific device model and import the entire project file into the MCUXpresso IDE to add groups.
Since Lvgl does not directly support mechanical keys as Input devices, you will need to create a custom Input Device. This device will be responsible for detecting the keystroke status and sending keystroke events to the Lvgl's input system.
In the setup_scr_screen.c file under the generated folder, you can create groups and place all the widgets(keypads) in them.
Hope my reply can help you.
Best Regards
Liu
Hi @qqt_996 ,
What about trying to swap the code sequences like this:
/* ---------------------- Code Begins ---------------------- */
lv_group_t *group = lv_group_create();
lv_indev_set_group(keypadIndevice, group);
lv_group_add_obj(group, ui->BootPage_btn_1);
lv_group_add_obj(group, ui->BootPage_btn_2);
/* ----------------------- Code Ends ----------------------- */
It works in my code.
Best Regards
Chester