KEYPAD, ENCODER: not send ENTER (process it in RELEASE signals)

This commit is contained in:
Gabor Kiss-Vamosi
2019-03-12 19:20:23 +01:00
parent 6967a8e52f
commit 89d56e5723
9 changed files with 180 additions and 146 deletions

View File

@@ -574,27 +574,33 @@ static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * p
ext->tab_name_ptr = NULL;
ext->btns = NULL; /*These objects were children so they are already invalid*/
ext->content = NULL;
} else if(sign == LV_SIGNAL_CORD_CHG) {
}
else if(sign == LV_SIGNAL_CORD_CHG) {
if(ext->content != NULL &&
(lv_obj_get_width(tabview) != lv_area_get_width(param) ||
lv_obj_get_height(tabview) != lv_area_get_height(param))) {
tabview_realign(tabview);
}
} else if(sign == LV_SIGNAL_FOCUS || sign == LV_SIGNAL_DEFOCUS || sign == LV_SIGNAL_CONTROLL) {
}
else if(sign == LV_SIGNAL_RELEASED) {
/*If released by a KEYPAD or ENCODER then really the tab buttons should be released.
* So simulate a CLICK on the tab buttons*/
lv_indev_t * indev = lv_indev_get_act();
lv_hal_indev_type_t indev_type = lv_indev_get_type(indev);
if(indev_type == LV_INDEV_TYPE_KEYPAD ||
(indev_type == LV_INDEV_TYPE_ENCODER && lv_group_get_editing(lv_obj_get_group(tabview))))
{
lv_obj_send_event(ext->btns, LV_EVENT_CLICKED);
}
}
else if(sign == LV_SIGNAL_FOCUS || sign == LV_SIGNAL_DEFOCUS || sign == LV_SIGNAL_CONTROLL) {
/* The button matrix is not in a group (the tab view is in it) but it should handle the group signals.
* So propagate the related signals to the button matrix manually*/
if(ext->btns) {
ext->btns->signal_cb(ext->btns, sign, param);
}
if(sign == LV_SIGNAL_CONTROLL) {
/*Simulate a click when enter is pressed*/
char c = *((char *)param);
if(c == LV_GROUP_KEY_ENTER) {
lv_obj_send_event(ext->btns, LV_EVENT_CLICKED);
}
}
else if(sign == LV_SIGNAL_FOCUS) {
if(sign == LV_SIGNAL_FOCUS) {
lv_hal_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
/*With ENCODER select the first button only in edit mode*/
if(indev_type == LV_INDEV_TYPE_ENCODER) {