2019-11-28 12:09 AM
I need to get the X and Y coordinates of the touch controller and use them in Model or a View.
Is there a simple way to do this? (something in the API)
basically I want to get the x and y values returned from the sampleTouch() in TouchController class.
Solved! Go to Solution.
2019-11-28 12:22 AM
Implement the following virtual function in your view.
/**
* @fn virtual void Screen::handleClickEvent(const ClickEvent& evt);
*
* @brief Traverse the drawables in reverse z-order and notify them of a click event.
*
* Traverse the drawables in reverse z-order and notify them of a click event.
*
* @param evt The event to handle.
*/
virtual void handleClickEvent(const ClickEvent& evt);
The ClickEvent has the data you need.
touchgfx/events/ClickEvent.hpp
/**
* @typedef enum ClickEventType
*
* @brief The click event types.
*/
typedef enum
{
PRESSED, ///< An enum constant representing the pressed option
RELEASED, ///< An enum constant representing the released option
CANCEL ///< An enum constant representing the cancel option
} ClickEventType;
...
private:
ClickEventType _type;
int16_t _x;
int16_t _y;
};
2019-11-28 12:22 AM
Implement the following virtual function in your view.
/**
* @fn virtual void Screen::handleClickEvent(const ClickEvent& evt);
*
* @brief Traverse the drawables in reverse z-order and notify them of a click event.
*
* Traverse the drawables in reverse z-order and notify them of a click event.
*
* @param evt The event to handle.
*/
virtual void handleClickEvent(const ClickEvent& evt);
The ClickEvent has the data you need.
touchgfx/events/ClickEvent.hpp
/**
* @typedef enum ClickEventType
*
* @brief The click event types.
*/
typedef enum
{
PRESSED, ///< An enum constant representing the pressed option
RELEASED, ///< An enum constant representing the released option
CANCEL ///< An enum constant representing the cancel option
} ClickEventType;
...
private:
ClickEventType _type;
int16_t _x;
int16_t _y;
};
2019-11-28 12:28 AM
Thank You!