Version 8 : Documentation regarding Keyboard-Widget is wrong


The documentation has wrong signatures for :

lv_keyboard_set_map() (and others)

Implementation :

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

What LVGL version are you using?


What do you want to achieve?

Customize the keyboard widget.

What have you tried so far?

Version 7 behaviour, it is obviously different, but the documentation is misleading.

Code to reproduce

    void kb_create(void)
        this->kb = lv_keyboard_create(lv_scr_act());
        const lv_btnmatrix_ctrl_t kb_ctrl[] = {
        const char* map[] = {"1"};
        lv_keyboard_set_map(this->kb, LV_KEYBOARD_MODE_NUMBER, map,kb_ctrl);

This leads to a seq fault. Can somebody hint me to a version 8 example on how to customize the keyboard component ? Thanks. (I wanted to post it in the bug section, but it is rather a how-to question). :smiley:

Your map is incorrect. It needs to be terminated according to the documentation for the button matrix…

The declaration of a map should look like const char * map[] = {"btn1", "btn2", "btn3", NULL} . Note that the last element has to be either NULL or an empty string ("" )!

Thanks, but I still get a seq fault and the documentation is still wrong.

Could you please show me a sample for version 8 with a keyboard-widget with just one numeric button ? (it worked pretty well for Version 7)

I guess I will just use a button matrix. The advantage of the keyboard widget is the predefined maps anyway, isn’t it ?

Update : Button matrix seems to work well.

The maps need to persist (be static). This works…

void kb_create(void)
    lv_obj_t* kb = lv_keyboard_create(lv_scr_act());
    static const lv_btnmatrix_ctrl_t kb_ctrl[] = {
    static const char* map[] = { "1", "" };
    lv_keyboard_set_mode(kb, LV_KEYBOARD_MODE_NUMBER);
    lv_keyboard_set_map(kb, LV_KEYBOARD_MODE_NUMBER, map, kb_ctrl);
1 Like

Newb error, thanks !