Community
Participate
Working Groups
I've got a login dialog with a composite containing : - a button for connection - a group with - a text login - a text password - a check buton for administrator with the tab navigation when i focus the check button, and with the space button i can can change the selection of the check button. without focusing the connection button, i want to select the connection button when hitting the return key. so waht i do was : add a keylistener on the check button, and if the keycode is equal to SWT.CR, i send a selection Event on the connection button. This works on FF and opera, but not in IE , Safari and Chrome : - on FF an OPERA : the KeyEvent is sent from client to server (request parameter) - on IE , Safari and Chrome : No keyEvent sent from client Note : when hitting alpha numeric caracters, the keyEvent is sent for all browsers.
If i what right, what you could use it shell.setDefaultButton. It sets the button that gets selected when Enter is pressed. I'm looking into why the Enter button isn't sent anyway.
Even setting the defaultButton on the shell does not work : (focus is present on the chexk button)
Sorry for the butchered comment#1. I think whats happening is that some widgets call preventDefault internally on certain keydown events (in this case button on Space and Enter), which prevents the keypress event the KeyEventUtil listens to from beeing fired. I would have to check in SWT to be certain, but i think the issue here is that KeyEventUtil only listens for keypress, when it should listen for both (keypress and keydown). I will investigate that possibility.
Turns out preventing default for keydown does not supress the follow-up keypress events, so the problem is another.
I revoke my precious comment, preventDefault is the problem. One workaround is to add the button you want to listen to the widgets cancel keys (see RWT.CANCEL_KEYS). But this will also prevent the check button from beeing selected/unselected by the enter key.
Partially fixed in CVS HEAD. Fixed for Combo, Button, ToolItem by removing some unnecessary preventDefault calls. For Text this is slightly more complicated, Backspace and Enter might both be necessary to cancel.
Fixed together with Bug 367876. Keydown events are now also used to send key events to server.