Hello all,
I have a Container (a Group) that has several child elements. Some of these are text labels and indicators, then there are two "buttons" (icons) in the left and right hand sides. Think of volume up/down buttons for example.
Currently I can press the buttons, but if I press anywhere else in the container, nothing happens.
What I would like to do is to catch all pointer events in the container, and forward them to the buttons. For example if x < w/2, the event would be forwarded to the "left" button; if x >= w/2, the event would be forwarded to the "right" button.
I don't only want to send "click" events -- I need to send pressed/released events so that the buttons can also be updated to show the "selected" state and so on.
Currently I am doing the following:
public void ClickableGroup extends Group {
private Behavior.Click _behave;
public ClickableGroup() {
_behave = new Behavior.Click(this);
// Absorb all clicks that do not hit a child of this layer
set(Flag.HIT_ABSORB, true);
// wire up our behavior as a layer listener
layer.events().connect(_behave);
}
[...]
}
With this I can already receive pointer events in the ClickableGroup object. However I am not sure how to "forward" these events to specific child elements in the group (in fact I don't even know if this is supported out of the box)
Any hints / recommendations?
Thank you,
Guillermo