Community
Participate
Working Groups
I20080909-1121, carbon Menu#setVisible(..) should immediately show the menu, also while handling mouseDown event on a button. Steps: - run the snippet below - press left mouse button down on the button and hold it down => expected (works fine on WinXP): Menu should show up. Moving the mouse to the menu item and releasing it there should execute the menu item. => was: Popup menu only shows up after mouseUp. This can be seen in Eclipse for the view menu button, the menu buttons in the Quick Outline, Open Resource dialog, etc. public class SnippetButtonMouseDown { public static void main(String[] args) { final Display display= new Display(); final Shell shell= new Shell(display, SWT.DIALOG_TRIM); GridLayout shellLayout= new GridLayout(2, false); shell.setLayout(shellLayout); final Button button= new Button(shell, SWT.PUSH); button.setText("Button"); button.addMouseListener(new MouseAdapter() { public void mouseDown(org.eclipse.swt.events.MouseEvent e) { Menu menu= new Menu(button); MenuItem item= new MenuItem(menu, SWT.PUSH); item.setText("Item"); item.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { System.out.println("selected"); } }); menu.setLocation(button.toDisplay(0, button.getSize().y)); menu.setVisible(true); } }); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } }
Adding display.runPopups (); at the end of Menu#setVisible(boolean) makes click-drag-release work, but leaves the menu open after the user has selected the menu item.
Might be a duplicate of bug#216062.
> Might be a duplicate of bug#216062. Nope, that one works for me in I20090515-1143 Cocoa, but menu.setVisible(true) in the mouseDown(..) handler still doesn't show the menu immediately.
Also happens on cocoa.
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. -- The automated Eclipse Genie.
This bug has been marked as stalebug a while ago without any further interaction. If this report is still relevant for the current release, please reopen and remove the stalebug whiteboard flag.
This bug was marked as stalebug a while ago. Marking as worksforme. If this report is still relevant for the current release, please reopen and remove the stalebug whiteboard tag.