Hello,
I use multilanguage GUI, and I can't rely on button's text to identify the button being pressed, as it can have multiple different values based on the GUI language used.
What is the proper way to use lv_obj_set_free_num on the buttons on a message box, and then use that in the click action callback?
Thanks!
@mharizanov lv_obj_set_free_num doesn't work on button matrices (which lv_mbox uses) because they are not really composed of multiple buttons. However, I read the area of lv_btnm.c that deals with button click handling, and this might work inside the lv_mbox callback action (untested):
lv_btnm_ext_t *btnm_ext = lv_obj_get_ext_attr(btnm);
if(btnm_ext->btn_id_pr == 0) { } /* First button */
else if(btnm_ext->btn_id_pr == 1) { } /* Second button */
@kisvegabor If it works I think this would be a good API to add.
Yes, that worked. Thanks! I think an API call makes sense for use cases like mine.
I agree it'd be really useful.
I added the API extension here: #563 Please have a look at it.
Thanks Gabor, you rock!