How to recieve touch position by manually?

I create a container and a image in the container.
And set container dragable by horisontally.

If I would like to receive current touch position for controlling another function manually,
how to set any function for the container or any advice?

Thank you.

  lv_obj_t *container = lv_cont_create(lv_scr_act(),NULL);
  lv_obj_set_drag(container, true);
  lv_obj_set_drag_dir(container, LV_DRAG_DIR_HOR);

  lv_obj_t *image = lv_img_create(container,NULL);
  lv_img_set_src(image, &img_background);


Set an event function for the container and in LV_EVENT_PRESSING:

    lv_indev_t * indev = lv_indev_get_act();
    lv_point_t p;
    lv_indev_get_point(indev, &p);
1 Like