fix(examples) use type-safe function for retrieving event param

Fixes #3364
This commit is contained in:
embeddedt
2022-05-18 13:58:35 -04:00
parent 276f28a8a2
commit 71d535defd
3 changed files with 4 additions and 4 deletions

View File

@@ -8,7 +8,7 @@ static void set_value(void * bar, int32_t v)
static void event_cb(lv_event_t * e) static void event_cb(lv_event_t * e)
{ {
lv_obj_draw_part_dsc_t * dsc = lv_event_get_param(e); lv_obj_draw_part_dsc_t * dsc = lv_event_get_draw_part_dsc(e);
if(dsc->part != LV_PART_INDICATOR) return; if(dsc->part != LV_PART_INDICATOR) return;
lv_obj_t * obj = lv_event_get_target(e); lv_obj_t * obj = lv_event_get_target(e);

View File

@@ -7,7 +7,7 @@ static void event_cb(lv_event_t * e)
lv_event_code_t code = lv_event_get_code(e); lv_event_code_t code = lv_event_get_code(e);
lv_obj_t * obj = lv_event_get_target(e); lv_obj_t * obj = lv_event_get_target(e);
if(code == LV_EVENT_DRAW_PART_BEGIN) { if(code == LV_EVENT_DRAW_PART_BEGIN) {
lv_obj_draw_part_dsc_t * dsc = lv_event_get_param(e); lv_obj_draw_part_dsc_t * dsc = lv_event_get_draw_part_dsc(e);
/*Change the draw descriptor the 2nd button*/ /*Change the draw descriptor the 2nd button*/
if(dsc->id == 1) { if(dsc->id == 1) {
@@ -34,7 +34,7 @@ static void event_cb(lv_event_t * e)
} }
} }
if(code == LV_EVENT_DRAW_PART_END) { if(code == LV_EVENT_DRAW_PART_END) {
lv_obj_draw_part_dsc_t * dsc = lv_event_get_param(e); lv_obj_draw_part_dsc_t * dsc = lv_event_get_draw_part_dsc(e);
/*Add custom content to the 4th button when the button itself was drawn*/ /*Add custom content to the 4th button when the button itself was drawn*/
if(dsc->id == 3) { if(dsc->id == 3) {

View File

@@ -4,7 +4,7 @@
static void draw_part_event_cb(lv_event_t * e) static void draw_part_event_cb(lv_event_t * e)
{ {
lv_obj_t * obj = lv_event_get_target(e); lv_obj_t * obj = lv_event_get_target(e);
lv_obj_draw_part_dsc_t * dsc = lv_event_get_param(e); lv_obj_draw_part_dsc_t * dsc = lv_event_get_draw_part_dsc(e);
/*If the cells are drawn...*/ /*If the cells are drawn...*/
if(dsc->part == LV_PART_ITEMS) { if(dsc->part == LV_PART_ITEMS) {
uint32_t row = dsc->id / lv_table_get_col_cnt(obj); uint32_t row = dsc->id / lv_table_get_col_cnt(obj);