Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LVGL] gesture event LV_EVENT_GESTURE missing #436

Closed
lehoangphuc86 opened this issue Jul 6, 2024 · 8 comments
Closed

[LVGL] gesture event LV_EVENT_GESTURE missing #436

lehoangphuc86 opened this issue Jul 6, 2024 · 8 comments
Assignees
Milestone

Comments

@lehoangphuc86
Copy link

Hi Team,

I am new to this tool. While designing our GUI, it seems we are missing the LV_EVENT_GESTURE event on the event dropdown.
May I know how to detect the gesture event like the lvgl natively supports?

Appreciate your response.
Version: 0.14.2
LVGL: 8.3

Peter

@mvladic mvladic added this to the M21 milestone Jul 6, 2024
mvladic added a commit that referenced this issue Jul 6, 2024
@mvladic
Copy link
Contributor

mvladic commented Jul 6, 2024

Done. Will be released in EEZ Studio version 0.15.0.

Here is an example project:

test_gesture_event.zip

gesture

@mvladic
Copy link
Contributor

mvladic commented Jul 6, 2024

To receive Gesture event, "Gesture bubble" flag must be unchecked:

image

@lehoangphuc86
Copy link
Author

Thanks for your quick action. It means there is no option to get the gesture event in 0.14.2 right?
Also, I am working in lvgl + eez without flow. In my screen, I only have the dropdown to select the possible events.

image

@mvladic
Copy link
Contributor

mvladic commented Jul 7, 2024

It means there is no option to get the gesture event in 0.14.2 right?

Correct.

@mvladic
Copy link
Contributor

mvladic commented Jul 7, 2024

Also, I am working in lvgl + eez without flow. In my screen, I only have the dropdown to select the possible events.

You can always add event handler from the code.

@lehoangphuc86
Copy link
Author

Also, I am working in lvgl + eez without flow. In my screen, I only have the dropdown to select the possible events.

You can always add event handler from the code.

It means, I need to modify the generated source code to handle the LV_EVENT_GESTURE event right?
I prefer to not touching the generated source code, because any time I modify something on the GUI, I will re-generate and it will override my modification.
Currently, I am separating the generated source and the app implementation.
If you confirm the same, in the next version, I think it is better to add all supported events into the dropdown on the studio or let user add their customize event name .

Thank you. I will close the issue after your confirmation.

@mvladic
Copy link
Contributor

mvladic commented Jul 7, 2024

It means, I need to modify the generated source code to handle the LV_EVENT_GESTURE event right?

No, I didn't mean to modify the generated source code. After ui_init() you can add any additional initialization for whatever reason, most often because something is not supported by the Studio. You can set the "Name" property of the widget you wish to reference from your custom code. For example:

#include "src/ui.h"

static void gesture_event_handler(lv_event_t *e) {
  lv_dir_t dir = lv_indev_get_gesture_dir(lv_indev_active());
  switch(dir) {
    case LV_DIR_LEFT:
      ...
      break;
    case LV_DIR_RIGHT:
      ...
      break;
    case LV_DIR_TOP:
      ...
      break;
    case LV_DIR_BOTTOM:
      ...
      break;
  }
}

int main() {
  ...

  ui_init();

  // my custom initialization, 
  // here we reference the widget with the Name "my_widget"
  lv_obj_add_event_cb(objects.my_widget, gesture_event_handler, LV_EVENT_GESTURE, 0);

  ...
}

@lehoangphuc86
Copy link
Author

Thank you for the clarification. Please close this case.

@mvladic mvladic changed the title [lvgl] gesture event LV_EVENT_GESTURE missing [LVGL] gesture event LV_EVENT_GESTURE missing Aug 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants