| Summary: | no event on menu item selection | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Andrei Diaconu <andi_dm1> |
| Component: | SWT | Assignee: | Platform-SWT-Inbox <platform-swt-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | remy.suen |
| Version: | 3.7.1 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | stalebug | ||
The workaround is to setVisible(false) instead of disposing the shell, and schedule the disposing for later with asyncExec. This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. If the bug is still relevant, please remove the "stalebug" whiteboard tag. The problem still occurs, but as mentioned before, I have a workaround. Maybe it is OK to close the ticket, because it is a strange timing situation: * the shell is being disposed because the exit event * the menu belonging to the shell being disposed wants to fire the event |
To reproduce the bug, do the following using the snippet given below: * click anywhere on the shell without trim (a popup menu appears) * click on the menu item You will notice that no selection event has been generated. import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.*; public class NoSelectionEvent { public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.open(); final Shell secondShell = new Shell(shell, SWT.NO_TRIM); final Listener listener = new Listener() { @Override public void handleEvent(Event event) { switch (event.type) { case SWT.MouseUp: final Menu menu = new Menu(secondShell, SWT.POP_UP); final MenuItem menuItem = new MenuItem(menu, SWT.NONE); menuItem.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { System.out.println("menu item selected"); } }); menu.setVisible(true); break; case SWT.MouseExit: secondShell.dispose(); break; } } }; secondShell.addListener(SWT.MouseUp, listener); secondShell.addListener(SWT.MouseExit, listener); secondShell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } } I need this dispose-on-exit behavior for tools that appear on hover, sort of rich tooltips.