2019-08-11 07:38 PM
I am using touchGFX to develop a screen. Now there is a problem .When I add a ClickListener and ClickAction Callback to a box, a click on the box will be identified as a click. But if I want to use a gesture on the box , I found it will be identified as a click too. It is not what I want. I found a article in TouchGFX Knowledge base , but I was told I'm not authorized to access this page. Can anyone help me solve this problem? Or can anyone access this page? The address is https://touchgfx.zendesk.com/hc/en-us/articles/205983261
Thanks a lot!
Solved! Go to Solution.
2019-08-13 04:36 AM
Hi @Breeze,
What do you mean by "Want to use a gesture", exactly? What kind of gesture? TouchGFX does not support "gestures", in the classic sense, except swipe. You have some handlers available to you:
/**
* @fn virtual void Drawable::handleDragEvent(const DragEvent& evt)
*
* @brief Defines the event handler interface for DragEvents.
*
* Defines the event handler interface for DragEvents. The event is only received if
* the drawable is touchable.
*
* @param evt The DragEvent received from the HAL.
*/
virtual void handleDragEvent(const DragEvent& evt) { }
/**
* @fn virtual void Drawable::handleClickEvent(const ClickEvent& evt)
*
* @brief Defines the event handler interface for ClickEvents.
*
* Defines the event handler interface for ClickEvents. The default implementation
* ignores the event. The event is only received if the drawable is touchable.
*
* @param evt The ClickEvent received from the HAL.
*/
virtual void handleClickEvent(const ClickEvent& evt) { }
/**
* @fn virtual void Drawable::handleGestureEvent(const GestureEvent& evt)
*
* @brief Defines the event handler interface for GestureEvents.
*
* Defines the event handler interface for GestureEvents. The default implementation
* ignores the event. The event is only received if the drawable is touchable.
*
* @param evt The GestureEvent received from the HAL.
*/
virtual void handleGestureEvent(const GestureEvent& evt) { }
typedef enum
{
SWIPE_HORIZONTAL, ///< An enum constant representing a horizontal swipe
SWIPE_VERTICAL ///< An enum constant representing a vertical swipe
} GestureType;
In conclusion:
Implement these handlers in your view or in your widgets to see how TouchGFX interprets the touch events you produce. For a simple touch you'll get two calls to handleClickEvent() (screen press/release). For a drag you'll receive at least 3 calls.
The ScrollableContainer and the SwipeContainer (touchgfx\containers\) both use handleGestureEvent() to properly react to swipes.
/Martin
2019-08-13 04:36 AM
Hi @Breeze,
What do you mean by "Want to use a gesture", exactly? What kind of gesture? TouchGFX does not support "gestures", in the classic sense, except swipe. You have some handlers available to you:
/**
* @fn virtual void Drawable::handleDragEvent(const DragEvent& evt)
*
* @brief Defines the event handler interface for DragEvents.
*
* Defines the event handler interface for DragEvents. The event is only received if
* the drawable is touchable.
*
* @param evt The DragEvent received from the HAL.
*/
virtual void handleDragEvent(const DragEvent& evt) { }
/**
* @fn virtual void Drawable::handleClickEvent(const ClickEvent& evt)
*
* @brief Defines the event handler interface for ClickEvents.
*
* Defines the event handler interface for ClickEvents. The default implementation
* ignores the event. The event is only received if the drawable is touchable.
*
* @param evt The ClickEvent received from the HAL.
*/
virtual void handleClickEvent(const ClickEvent& evt) { }
/**
* @fn virtual void Drawable::handleGestureEvent(const GestureEvent& evt)
*
* @brief Defines the event handler interface for GestureEvents.
*
* Defines the event handler interface for GestureEvents. The default implementation
* ignores the event. The event is only received if the drawable is touchable.
*
* @param evt The GestureEvent received from the HAL.
*/
virtual void handleGestureEvent(const GestureEvent& evt) { }
typedef enum
{
SWIPE_HORIZONTAL, ///< An enum constant representing a horizontal swipe
SWIPE_VERTICAL ///< An enum constant representing a vertical swipe
} GestureType;
In conclusion:
Implement these handlers in your view or in your widgets to see how TouchGFX interprets the touch events you produce. For a simple touch you'll get two calls to handleClickEvent() (screen press/release). For a drag you'll receive at least 3 calls.
The ScrollableContainer and the SwipeContainer (touchgfx\containers\) both use handleGestureEvent() to properly react to swipes.
/Martin
2019-08-15 10:54 PM
Thanks for your answer.
My "Gesture" also means swipe. I found in Screen , there are two virtual function, virtual void handleClickEvent(const ClickEvent& evt) and virtual void handleGestureEvent(const GestureEvent& evt). If I am using these two functions in my Screen. It always easy to response handleClickEvent, but hard to response handleGestureEvent . So I want to konw waht can I do to make it work properly.
2019-08-15 10:55 PM
Thanks for your answer.
My "Gesture" also means swipe. I found in Screen , there are two virtual function, virtual void handleClickEvent(const ClickEvent& evt) and virtual void handleGestureEvent(const GestureEvent& evt). If I am using these two functions in my Screen. It always easy to response handleClickEvent, but hard to response handleGestureEvent . So I want to konw waht can I do to make it work properly.