How to create keypads and groups

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to create keypads and groups

2,101件の閲覧回数
acd
Contributor II

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.

0 件の賞賛
返信
5 返答(返信)

2,075件の閲覧回数
Alphabert_Liu
NXP Employee
NXP Employee

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.

屏幕截图 2024-07-31 151345.png

Specific keyboard usage can be found in keyboard.c in the lvgl\src\extra\widgets\keyboard folder of your project.

Best Regards

Liu

 

0 件の賞賛
返信

2,063件の閲覧回数
acd
Contributor II

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.

0 件の賞賛
返信

2,054件の閲覧回数
Alphabert_Liu
NXP Employee
NXP Employee

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

0 件の賞賛
返信

1,792件の閲覧回数
qqt_996
Contributor I
Hello, I encountered the same problem. The page I exported using the "gui guide" code will turn white after adding group, and the page cannot be loaded. It is added in "setup_scr_screen";
lv_group_t *group = lv_group_create();
lv_group_add_obj(group, ui->BootPage_btn_1);
lv_group_add_obj(group, ui->BootPage_btn_2);
lv_indev_set_group(keypadIndevice, group);
0 件の賞賛
返信

1,305件の閲覧回数
ChesterLee
Contributor II

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

タグ(2)
0 件の賞賛
返信