| Summary: | Menu and field get focus at the same time | ||
|---|---|---|---|
| Product: | [RT] RAP | Reporter: | John Gymer <jgymer> |
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | tbuschto |
| Version: | 3.1 | ||
| Target Milestone: | 3.1 M1 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
I can reproduce it with your snippet and RAP 3.0M6+. That's great Ivan... any chance of a 2.3 fix too so that the next drop of Tabris can pick it up, which is what I'm using server-side? Thanks, John Sorry John, but we do not plan any new 2.3 service releases. We'll try to fix it for 3.0 release. Hi Ivan, Is this likely to make RAP 3.0? I have a customer chasing it. Thanks, John > Is this likely to make RAP 3.0?
I don't think so, it's not critical enough to risk any changes on that part of RAP in the RC phase.
Unfortunately our customer views it as a "must have" fix. If it doesn't make 3.0, do you have a clue as to when it will make it? Thanks Hi Tim/Ivan, Now that RAP 3.0 is out, would it be possible to have an idea of when you might be able to fix this accelerator/shortcut bug? Thanks, John Fixed with commit 5268b9ed112ad54e6430504f164195f9ed65861d, "Cancel DOM key events that are captured by another widget". The menu bar doesn't really have a focus but is into "capture" mode when active, meaning it is supposed to "grab" all mouse and key events. That didn't work properly for key events. Not that the given snippet will still not work quite right due to an unrelated issue with menu bar items that have no dropdown menu attached. If a menu is attached it works fine. |
Using RAP 2.3 there seems to be a focus bug when a shell has both a menu bar and a field, with RWT.MNEMONIC_ACTIVATOR set... here is a snippet: /* DEMONSTRATES Mnemonic Active Keys issue */ package bug.snippet; import org.eclipse.rap.rwt.RWT; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.MenuItem; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; public class Bugsy { Display display; Shell shell; Label lab; public void begin() { display = new Display(); display.setData(RWT.MNEMONIC_ACTIVATOR, "CTRL+ALT"); shell = new Shell(display, SWT.APPLICATION_MODAL|SWT.CLOSE); shell.setFullScreen(true); shell.setText("My Shell"); FormLayout layout = new FormLayout(); shell.setLayout(layout); FormData fd; Text myField = new Text(shell, SWT.BORDER|SWT.SINGLE); myField.setText(""); myField.setMessage("Press CTRL+ALT then type an 'F' key!"); fd = new FormData(); fd.left = new FormAttachment(0, 10); fd.top = new FormAttachment(0, 50); fd.right = new FormAttachment(100,-10); fd.bottom = new FormAttachment(0, 80); myField.setLayoutData(fd); Button myBut = new Button(shell, SWT.PUSH); myBut.setText("My &Button"); fd = new FormData(); fd.left = new FormAttachment(0, 10); fd.top = new FormAttachment(0, 90); fd.right = new FormAttachment(100,-10); fd.bottom = new FormAttachment(0, 120); myBut.setLayoutData(fd); Button myBut2 = new Button(shell, SWT.PUSH); myBut2.setText("My &Other Button"); fd = new FormData(); fd.left = new FormAttachment(0, 10); fd.top = new FormAttachment(0, 130); fd.right = new FormAttachment(100,-10); fd.bottom = new FormAttachment(0, 160); myBut2.setLayoutData(fd); Menu myMenu = new Menu(shell, SWT.BAR); MenuItem menuItemFile = new MenuItem(myMenu, SWT.CASCADE); menuItemFile.setText("&File"); shell.setMenuBar(myMenu); shell.open(); } } Very simple example, with a menu bar containing just a file menu, plus a field (Text) and a couple of Buttons with mnemonics defined. Run this snippet and press CTRL+ALT to see the mnemonics. Just press CTRL+ALT once and the menu bar gets some sort of focus, but the keyboard caret stays in the Text entry field. If you now press the 'f' key, it chooses the 'File' menu (because this has focus and has 'F' defined as its mnemonic), but you also get an 'F' character appear in the field. It is like both controls (menu and text field) have focus, so both get the keyboard event sent to them. This does not happen in SWT. Thanks, John