pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Bartlett <cbartlet...@gmail.com>
Subject Re: avoid sheet close by press "Enter"
Date Wed, 18 Aug 2010 12:14:07 GMT
On 18 August 2010 19:02, Greg Brown <gkbrown@mac.com> wrote:

>
> > The following code snippet shows a quick way to do this for a particular
> Sheet instance.
> >
> > sheet.getComponentKeyListeners().add(new ComponentKeyListener.Adapter() {
> > @Override
> > public boolean keyPressed(Component component, int keyCode, KeyLocation
> keyLocation) {
> > final Sheet sheet = (Sheet) component;
> >
> > // Block the Enter key press behaviour
> > if (keyCode == Keyboard.KeyCode.ENTER) {
> > // No-op, but consume the event
> > return true;
> > }
> > ...
> > });
>
>  This actually doesn't work. Consuming an event simply stops its
> propagation up the component hierarchy. It doesn't prevent other listeners
> on the same component from receiving the event.
>

Of course - I was mixing up my scenarios.  Apologies for any confusion.
Am I right in thinking that the above code should work if it is set on a
subclass of TerraSheetSkin, as that would receive the event first and be
able to consume it?

Mime
View raw message