refactor(event): use lv_event_get_orignal_target instead of current_target
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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*/
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user