feat(msgbox): add function to get selected button index (#2538)
This adds a new function lv_msgbox_get_active_btn that works analogously to lv_msgbox_get_active_btn_text but returns the button index instead of its text. The index is more convenient for comparison in localized applications as it doesn't depend on the current language.
This commit is contained in:
@@ -43,7 +43,7 @@ lv_obj_t * lv_msgbox_get_btns(lv_obj_t * mbox);
|
||||
|
||||
## Events
|
||||
- `LV_EVENT_VALUE_CHANGED` is sent by the buttons if one of them is clicked. `LV_OBJ_FLAG_EVENT_BUBBLE` is enabled on the buttons so you can add events to the message box itself.
|
||||
In the event handler, `lv_event_get_target(e)` will return the button matrix and `lv_event_get_current_target(e)` will givreturn the message box. `lv_msgbox_get_active_btn_text(msgbox)` can be used to get the text of the clicked button.
|
||||
In the event handler, `lv_event_get_target(e)` will return the button matrix and `lv_event_get_current_target(e)` will return the message box. `lv_msgbox_get_active_btn(msgbox)` and `lv_msgbox_get_active_btn_text(msgbox)` can be used to get the index and text of the clicked button.
|
||||
|
||||
Learn more about [Events](/overview/event).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user