Getting PC Keyboard to work

Description

Trying to get the PC Keyboard working in emulator to edit text in a lv_ta

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

PC Simulator VS

What do you want to achieve?

Be able to type in a text area

What have you tried so far?

I have both tried in my own application, and just now downloaded the VS Simulator project.

The KB is initialized, and I would assume it is working. But typing on the TA does nothing

Code to reproduce

#if USE_KEYBOARD
	lv_indev_drv_t kb_drv;
	lv_indev_drv_init(&kb_drv);
	kb_drv.type = LV_INDEV_TYPE_KEYPAD;
	kb_drv.read_cb = keyboard_read;
	kb_indev = lv_indev_drv_register(&kb_drv);
#endif

In the above code, USE_KEYBOARD == 1

I think I am missing a step somewhere.

Screenshot and/or video

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

Well I started tearing into the code, and I apparently need to assign a group.

1 Like

Did you tie the keyboard to the text area using lv_kb_set_ta(keyboard_obj, text_area);? There has to be something to tie the keyboard events to updating the text area, and this function would handle that for you.

@tarvik Actually, you only need that for the software keyboard. Hardware keyboards need to be assigned to a group.

@rohmer Perhaps the group example would be useful.

Ah! My mistake. I’ve only toyed with the software keyboard.

Yep I figured it out.

I guess I just assumed the TA would automatically be registered on click to the hw keyboard.

The only types of devices that “automatically” gets registered to objects are pointer-based devices like mice or touchscreens.