refactor(event): use lv_event_get_orignal_target instead of current_target

This commit is contained in:
Gabor Kiss-Vamosi
2023-03-06 12:47:18 +01:00
parent 1d6ea3af51
commit 680d6d1a7d
41 changed files with 65 additions and 65 deletions

View File

@@ -4,7 +4,7 @@
static void event_handler(lv_event_t * e)
{
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t * obj = lv_event_get_current_target(e);
lv_obj_t * obj = lv_event_get_target(e);
if(code == LV_EVENT_VALUE_CHANGED) {
lv_calendar_date_t date;

View File

@@ -3,7 +3,7 @@ def event_handler(e):
code = e.get_code()
if code == lv.EVENT.VALUE_CHANGED:
source = e.get_current_target_obj()
source = e.get_target_obj()
date = lv.calendar_date_t()
if source.get_pressed_date(date) == lv.RES.OK:
calendar.set_today_date(date.year, date.month, date.day)

View File

@@ -9,8 +9,8 @@ static uint32_t active_index_2 = 0;
static void radio_event_handler(lv_event_t * e)
{
uint32_t * active_id = lv_event_get_user_data(e);
lv_obj_t * cont = lv_event_get_current_target(e);
lv_obj_t * act_cb = lv_event_get_target(e);
lv_obj_t * cont = lv_event_get_target(e);
lv_obj_t * act_cb = lv_event_get_original_target(e);
lv_obj_t * old_cb = lv_obj_get_child(cont, *active_id);
/*Do nothing if the container was clicked*/

View File

@@ -49,8 +49,8 @@ class LV_Example_Checkbox_2:
def radio_event_handler(self,e):
cont = e.get_current_target_obj()
act_cb = e.get_target_obj()
cont = e.get_target_obj()
act_cb = e.get_original_target_obj()
if cont == self.cont1:
active_id = self.active_index_1
else:

View File

@@ -3,7 +3,7 @@
static void event_cb(lv_event_t * e)
{
lv_obj_t * obj = lv_event_get_current_target(e);
lv_obj_t * obj = lv_event_get_target(e);
LV_UNUSED(obj);
LV_LOG_USER("Button %s clicked", lv_msgbox_get_active_btn_text(obj));
}