2022-04-19 10:59 PM
I'm trying to use handleGestureEvent in Screen.
But handleClickEvent and handleDragEvent are called correctly, and handleGestureEvent it is never shouted!
Should the "fire" of this event in the Screen class be activated in some way. I could not find anything in the documentation of TouchGFX
class ScreenView : public ScreenViewBase
{
public:
// .... //
auto handleGestureEvent (const GestureEvent & event) -> void override
{
ScreenViewBase::handleGestureEvent (event);
}
auto handleClickEvent (const ClickEvent & event) -> void override
{
ScreenViewBase::handleClickEvent (event);
}
auto handleDragEvent (const DragEvent & event) -> void override
{
ScreenViewBase::handleDragEvent (event);
}
};
2022-04-20 03:43 AM
Hello Panchev68,
handleGestureEvent can be triggered with a "swipe" event. You can use it like that :
in your Screen1View.hpp
class Screen1View : public Screen1ViewBase
{
public:
// ... //
virtual void handleGestureEvent(const GestureEvent& event);
};
in your Screen1View.cpp
void Screen1View::handleGestureEvent(const GestureEvent& event)
{
// action to be done
}
You'll find attached an example of a project using that GestureEvent :)
/Osman
2022-04-20 06:40 AM
Thanks for the quick response and support !!!
As you can see, I'm doing exactly the same thing in my example. But even in the simulator in your project, the event is generated quite chaotically. Maybe I'm wrong in my approach. I expected that in case of "swipe" on the screen will call handleGestureEvent, as happens with handleClickEvent and handleDragEvent, but this is not true.
The handleGestureEvent is sometimes called only on a screen that has control that it uses with gesture. It is practically unusable, for example, for switching gesture screens. I tried it in my project and it works the same way as with you.
2022-04-21 01:07 AM
Yes, it can be hard to produce the event on the simulator. The way I do it is like I click with my mouse while moving it fast, I don't keep it pressed. Like as fast scrolling on your smartphone.
/Osman