| Summary: | Traverse event with detail = TRAVERSE_RETURN not fired in IE, Safari and Chrome | ||
|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Ivan Furnadjiev <ivan> |
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | tbuschto |
| Version: | 1.4 | ||
| Target Milestone: | 1.4 M5 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
| Bug Depends on: | |||
| Bug Blocks: | 329926 | ||
Fixed in CVS HEAD by updating EventHandlerUtil#getKeyCode and getCharCode |
When you press ENTER key on a control, TraverseEvent with detail = TRAVERSE_RETURN should be fired. This works in Firefox, but not in the browsers that use sync key events (IE, Safari, Chrome and Opera). The reason for it is that for these browsers the keyCode filed send from the browser is 0, but charCode is 13. In FF keyCode = 13, charCode=0. Thus, ControlLCAUtil#processKeyEvents determine the traverseKey as SWT.TRAVERSE_NONE, as it is taken from keyCode field only. As a result no TraverseEvent is fired. Snippet: Text text = new Text( parent, SWT.SINGLE | SWT.BORDER ); text.addKeyListener( new KeyListener() { public void keyPressed( final KeyEvent e ) { System.out.println( "keyPressed:" + e ); } public void keyReleased( final KeyEvent e ) { System.out.println( "keyReleased:" + e ); } } ); text.addTraverseListener( new TraverseListener() { public void keyTraversed( TraverseEvent e ) { System.out.println( "keyTraversed:" + e ); } } ); To reproduce, press ENTER key in the text filed. KeyEvents are fired, but not the TraverseEvent. Works fine in Firefox. This functionality is needed to prevent the default button in the cell editors - see bug 329926.