LVGL Button cannot be clicked in Demo project

Hi, im learning lvgl using the demo code but when i click any button, this if block returns false. i have tried using LV_EVENT_PRESSED, LV_SHORT_CLICKED and many more. none of them seem to work. need help here

void ui_event_ON5(lv_event_t * e) {
lv_event_code_t event_code = lv_event_get_code(e);
if(event_code == LV_EVENT_CLICKED) {
button1_on(e); }
}

reference: https://docs.lvgl.io/master/widgets/button.html#simple-buttons

Hey, how are you attaching the LV_CODE to the button? can you show more of the code?


LV_EVENT_CLICKED, PRESSED, SHORT_CLICKED are not working. the touch is detected but the event clicked isnt fired. any idea?

I didn’t see on the code you adding the button to a group with lv_group_add_obj(), are you adding the group in another part of the code? if not try adding to the group you buttons are!

The method ui_event_ON5(lv_event_t *e) are static? if not try make it.

can you print something inside the function?

I have solved this problem. All i have to do is to set LV_TICK_CUSTOM in lv_conf.h to 1.
Thank you for your assistance anyway :slight_smile: