Environment: LVGL8 with the windows simulator.
I want to create a event call back on a object so that a animation can be started when I press a key. So I added a event call back like this:
lv_obj_add_event_cb(scr, keyPadCallBack, LV_EVENT_KEY, NULL);
void keyPadCallBack(lv_event_t* e) {
uint32_t key = lv_event_get_key(e);
if (key == LV_KEY_UP) {
if (currentIndex > 0) {
currentIndex–;
}
}
else if (key == LV_KEY_DOWN) {
if (currentIndex < 9) {
currentIndex++;
}
}
}
The call back function is successfully called when I press a key, but after that the program keeps call the call back function even if I didn’t press any key.