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.
I now can successfully get the key by changing the current screen into the inner object in my case is the TabView1. The following code displays the key and quit the app when key = ESC. No continuously occurs, the callback triggered only once.
static void my_event_key_cb(lv_event_t* event)
{
lv_indev_t* i = lv_indev_get_act();
uint32_t key = 0;
if (i) key = lv_indev_get_key(i);
std::cout << "key: " << key << std::endl;
if (key == 27) lv_win32_quit_signal = true;