cancel
Showing results for 
Search instead for 
Did you mean: 

Triggering ClickEvent for more than one widget

maciek
Associate II

Hello,

I am using slideMenu widget and it works fine. Now I am trying to open this widget by a gesture. Normally I would override gestureEventCallback in my View- and actually I did it but it does not work well. I have two slide menus on top and on the left and if I slide from the left to right at 30o angle I get 2 gestures- HORIZONTAL and VERTICAL, always in the same order therefore it is impossible for me to detect if I should open top or left menu.

I came to idea that I can first check the click event for pressed, save the coordinates, wait for gesture event and then wait for released click event- in that combination I am able to get all data to find out if I should open top or left menu. But If I override click event in my view I can not trigger buttons which are present in the view.

So my question is- is it possible to, after I trigger view's clickEventHandler pass the event further to trigger next widget in the area where the click occured? Is TouchGFX capable of doing that?

1 ACCEPTED SOLUTION

Accepted Solutions
Martin KJELDSEN
Chief III

You can also just forward it application-wide by calling Application::handleClickEvent(evt);

/Martin

View solution in original post

5 REPLIES 5
Martin KJELDSEN
Chief III

Hi @maciek​,

Simply forward the event to any widget using widget.handleClickEvent(evt); //evt gotten from your views handleClickEvent();

/Martin

maciek
Associate II

Yea but let's assume I don't know what widgets are on the position where the event occured. Solution with calling handleClickEvent assumes I know what widget I should trigger. I would like to pass it further without concerning about x/y.

I did it manually- I know that there can be only 1 container that's children can be triggered:

Drawable* widget = containerMain.getFirstChild();
while (widget != 0)
{
	Rect rect;
	rect = widget->getAbsoluteRect();
	if (evt.getX() > rect.x && evt.getX() < rect.x + rect.width
			&& evt.getY() > rect.y && evt.getY() < rect.y+ rect.height
			&& widget->isTouchable())
	{
		widget->handleClickEvent(evt);
	}
	widget = widget->getNextSibling();
}

Martin KJELDSEN
Chief III

You can also just forward it application-wide by calling Application::handleClickEvent(evt);

/Martin

JHarding
Senior

Im not sure if the source code has just changed since this post was initially made, but the only way I could call the handleClickEvent(evt) on the application was like this:

Application::getInstance()->handleClickEvent(evt);

Hi @JHarding​ ,

I wonder how to define evt in my class.