View | Details | Raw Unified | Return to bug 193318 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/swt/snippets/Snippet67.java (-11 / +1 lines)
Lines 32-48 Link Here
32
		item.setText ("Item " + i);
32
		item.setText ("Item " + i);
33
	}
33
	}
34
	final ToolItem item = new ToolItem (toolBar, SWT.DROP_DOWN);
34
	final ToolItem item = new ToolItem (toolBar, SWT.DROP_DOWN);
35
	item.addListener (SWT.Selection, new Listener () {
35
	item.setDropDownMenu(menu);
36
		public void handleEvent (Event event) {
37
			if (event.detail == SWT.ARROW) {
38
				Rectangle rect = item.getBounds ();
39
				Point pt = new Point (rect.x, rect.y + rect.height);
40
				pt = toolBar.toDisplay (pt);
41
				menu.setLocation (pt.x, pt.y);
42
				menu.setVisible (true);
43
			}
44
		}
45
	});
46
	toolBar.pack ();
36
	toolBar.pack ();
47
	shell.pack ();
37
	shell.pack ();
48
	shell.open ();
38
	shell.open ();

Return to bug 193318