mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
fix(btnmamatrix) fix focus event handling
This commit is contained in:
parent
57e211cc17
commit
3b58ef14e5
@ -206,7 +206,7 @@ void lv_group_focus_obj(lv_obj_t * obj)
|
||||
|
||||
if(g->frozen != 0) return;
|
||||
|
||||
// if(g->obj_focus != NULL && obj == *g->obj_focus) return;
|
||||
if(g->obj_focus != NULL && obj == *g->obj_focus) return;
|
||||
|
||||
/*On defocus edit mode must be leaved*/
|
||||
lv_group_set_editing(g, false);
|
||||
|
@ -763,6 +763,7 @@ static void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
|
||||
lv_obj_refresh_style(obj, LV_PART_ANY, LV_STYLE_PROP_ANY);
|
||||
}
|
||||
else if(cmp_res == _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD) {
|
||||
lv_obj_invalidate(obj);
|
||||
lv_obj_refresh_ext_draw_size(obj);
|
||||
}
|
||||
}
|
||||
|
@ -517,17 +517,20 @@ static void lv_btnmatrix_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
}
|
||||
|
||||
bool editing = lv_group_get_editing(lv_obj_get_group(obj));
|
||||
if(indev_type == LV_INDEV_TYPE_KEYPAD|| (indev_type == LV_INDEV_TYPE_ENCODER&& editing)) {
|
||||
uint32_t b = 0;
|
||||
if(btnm->one_check) {
|
||||
while(button_is_hidden(btnm->ctrl_bits[b]) || button_is_inactive(btnm->ctrl_bits[b]) || button_is_checked(btnm->ctrl_bits[b]) == false) b++;
|
||||
} else {
|
||||
while(button_is_hidden(btnm->ctrl_bits[b]) || button_is_inactive(btnm->ctrl_bits[b])) b++;
|
||||
}
|
||||
/*Focus the first button if there is not selected button*/
|
||||
if(btnm->btn_id_sel == LV_BTNMATRIX_BTN_NONE) {
|
||||
if (indev_type == LV_INDEV_TYPE_KEYPAD || (indev_type == LV_INDEV_TYPE_ENCODER && editing)) {
|
||||
uint32_t b = 0;
|
||||
if(btnm->one_check) {
|
||||
while(button_is_hidden(btnm->ctrl_bits[b]) || button_is_inactive(btnm->ctrl_bits[b]) || button_is_checked(btnm->ctrl_bits[b]) == false) b++;
|
||||
} else {
|
||||
while(button_is_hidden(btnm->ctrl_bits[b]) || button_is_inactive(btnm->ctrl_bits[b])) b++;
|
||||
}
|
||||
|
||||
btnm->btn_id_sel = b;
|
||||
} else {
|
||||
btnm->btn_id_sel = LV_BTNMATRIX_BTN_NONE;
|
||||
btnm->btn_id_sel = b;
|
||||
} else {
|
||||
btnm->btn_id_sel = LV_BTNMATRIX_BTN_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(code == LV_EVENT_DEFOCUSED || code == LV_EVENT_LEAVE) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user