Can text on buttonmatrix buttons easily be changed?

Is it possible to easily change the button text? I’ve tried a few things, but I usually end up with memory leaks as not all memory is/can be released.

What about something like this:


    static char btn1[16] = "First";
    static char btn2[16] = "Second";
    static const char * map[] = {btn1, btn2, ""};

    lv_obj_t * btnm = lv_btnm_create(lv_scr_act(), NULL);
    lv_btnm_set_map(btnm, map);

    btn2[0] = 'X';
    lv_btnm_set_map(btnm, map);

image