Widgets take events not for them
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-06-25 10:52 PM
I'm having problems with widgets taking events that weren't supposed to go to them.
For example, if I have a SwipeContainer with a Button. If I tap the button, I get a ClickEvent - that's good. But, if swipe, and just happen to start on the button, the button receives the ClickEvent, and the SwipeContainer doesn't receive a swipe event, even though I swiped, and didn't click.
Is there anyway around this? The call stack seems to originate events in Gestures.cpp, but this file doesn't appear to be provided, so it is hard to see what is happening. Is Gestures.cpp available?
Thanks,
Frank
- Labels:
-
TouchGFX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-06-26 2:17 AM
This is expected behavior, because everything starts with a click/press. What you need to do in this case is to "steal" the handleClick/Drag events and figure out if you're dragging, then forward the event to the swipe container, otherwise the click goes to the button. You may want to ask yourself if you really want a button in a swipe container; If that's the right design.
Let me know.
/Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-06-26 2:18 AM
I just remember that i made a small sample projec that has the exact behavior i just described (a while back) -. I'll see if i can find it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-06-26 4:31 PM
I'll give that a go. I can see similar behaviour in the scrollable container.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-03-18 2:40 AM
Hi,Martin
Im still studying English,please dont mind my mistake of expression..
I want to make a user class inherited from class Container , to get all touch event and then send it to include widget.
But I found that, I can not get touch event if there is a button on the container.
I had see scrollable container,but still don't understand why it can get touch event.
Different between my Container and scrollable container is the scrollbars. Is that add box in container can make container catch the touch event?
Best regards
