How to make image set callback when click

i have image , and i want if the click if have callback, i was make code like this

 //SETTING
    icon = lv_img_create(bg_top, NULL);
    lv_img_set_src(icon, &setting_icon);
    lv_obj_align(icon, NULL, LV_ALIGN_IN_TOP_LEFT, 180, 8);
    lv_obj_set_click(icon, setting_event_handler);

but setting_event_handler not running

You should use lv_obj_set_event_cb (in v7). lv_obj_set_click takes a boolean as a parameter and controls whether the object receives click events or not.

I strongly suggest configuring your compiler so that passing parameters of an incorrect type cause an error. It will save you a lot of headaches. :wink:

1 Like

thanks it work