I want to catch the defocus event of a roller, whenever I touch other areas than rollers.
So after the creation of the roller, I added this line:
But it doesn’t catch this event unless I touch the roller.-changing its value or click on it.-
What MCU/Processor/Board and compiler are you using?
What LVGL version are you using?
What do you want to achieve?
catch the defocus event of an object -here it is a roller- even if I didn’t touch it.
What have you tried so far?
setting the roller’s state manually to
LV_STATE_FOCUSED after its creation.
AFAIU, it’s because of this line:
proc->types.pointer.last_pressed = obj_to_focus;
in the body of
indev_click_focus function. which is called when we really touch the CTP. right?
So, Any suggestions for solving the problem?
So Is there any idea? @kisvegabor @embeddedt
You are right that
indev_click_focus won’t defocus any arbitrary items but only the one which was clicked before.
You can do hack like this:
extern lv_indev_t * my_indev;
my_indev->proc.types.pointer.last_pressed = roller1;
There could be an API function for this, but I’m not sure if it’s a good idea to expose this internal functionality to the user.
It worked, thanks.
But you know, when we use this:
we expect to catch a defocused event in the roller’s callback.
Can’t we do sth about this? What do you think?
The problem is that the roller won’t be defocused as the pointer defocuses only the widget is focused earlier.