how to get "event capture" with ofxUI

Is there a way to get ofxUI to “capture” touch events, so that the main app does not receive them?

I’m developing an iPad music app called MelodyMorph (see below), and it has some buttons and pop-up menus. I’m using the excellent ofxUI addon to create these UI widgets. I also have “bell” objects in my app, that you can tap to trigger a sound (these use the touch events in the main app). The problem is that if a bell ends up underneath an ofXUI button (i.e. in the same place), when you touch the button, you also touch the bell.

So, how can I set things up so that ofxUI captures touch events, such that in the cases where ofxUI detects a touch on a widget, that touch will not also be sent to the main app?

http://www.youtube.com/watch?v=VvbsxbbxljM

This is a big limitation in all of OF, the event system does not have a way of canceling or preventing default behavior.

it because the tricky game of keeping track what is showing and not letting events get through in the case another control has focus

I just wanted to post an update since I have more or less resolved this problem, and maybe it will help others. I got Reza (author of ofxUI) to help me by email, and here is the fix he suggested:

One way to fix the problem would be to check whether the GUI was hit or not upon touchdowns and etc. Like:

If(!gui->isHit(x,y))
{
//app interaction stuff
}

This is what I do whenever I don’t want the rest of the application to receive touches when the user interacts with the UI.

I hadn’t noticed the isHit function built into the UI widgets- that turned out to be a way to work around the problem (it’s not actually capturing the events, but a way to detect that the GUI was touched and prevent other interaction in that case).