Doubt about addShortcutListener event

I have this code:

textValorPagamento.addShortcutListener(new ShortcutListener("Shortcut Name", ShortcutAction.KeyCode.ENTER, null) { @Override public void handleAction(Object sender, Object target) { adicionarFormaPagamento(); } }); textObsPagamento.addShortcutListener(new ShortcutListener("Shortcut Name", ShortcutAction.KeyCode.ENTER, null) { @Override public void handleAction(Object sender, Object target) { adicionarFormaPagamento(); } }); textValorTroco.addShortcutListener(new ShortcutListener("Shortcut Name", ShortcutAction.KeyCode.ENTER, null) { @Override public void handleAction(Object sender, Object target) { finalizarPedido(); } }); So I have 3 textfield in 2 when my user hit enter I execute the same method, but when I hit enter in my textValorTroco (TextField) he execute the adicionarFormaPagamento() method and not the finalizarPedido()
why?

tks

Hi Fabio,
if you register more than one shortcut listener for the same keys combination only the first one will be invoked.

You can add the same listener to all text fields and then discriminate over the target object

ShortcutListener action = new ShortcutListener("Shortcut Name", ShortcutAction.KeyCode.ENTER, null) { @Override public void handleAction(Object sender, Object target) { if (target == textValorTroco) { finalizarPedido(); } else { adicionarFormaPagamento(); } } }); textValorPagamento.addShortcutListener(action); textObsPagamento.addShortcutListener(action); textValorTroco.addShortcutListener(action); HTH
Marco