Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 268963 Details for
Bug 505992
[Gtk] Replace deprecated gtk_menu_popup
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
Modified snippet for testing of asynchronous calls to Menu
file_505992.txt (text/plain), 1.85 KB, created by
Ian Pun
on 2017-06-19 16:22:19 EDT
(
hide
)
Description:
Modified snippet for testing of asynchronous calls to Menu
Filename:
MIME Type:
Creator:
Ian Pun
Created:
2017-06-19 16:22:19 EDT
Size:
1.85 KB
patch
obsolete
>/******************************************************************************* > * Copyright (c) 2000, 2016 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >package org.eclipse.swt.snippets; > >/* > * ToolBar example snippet: place a drop down menu in a tool bar > * > * For a list of all SWT example snippets see > * http://www.eclipse.org/swt/snippets/ > */ >import org.eclipse.swt.*; >import org.eclipse.swt.graphics.*; >import org.eclipse.swt.widgets.*; > >public class Snippet67 { > >public static void main (String [] args) { > final Display display = new Display (); > final Shell shell = new Shell (display); > final ToolBar toolBar = new ToolBar (shell, SWT.NONE); > Rectangle clientArea = shell.getClientArea (); > toolBar.setLocation(clientArea.x, clientArea.y); > final Menu menu = new Menu (shell, SWT.POP_UP); > for (int i=0; i<8; i++) { > MenuItem item = new MenuItem (menu, SWT.PUSH); > item.setText ("Item " + i); > } > final ToolItem item = new ToolItem (toolBar, SWT.DROP_DOWN); > item.addListener (SWT.Selection, event -> { > if (event.detail == SWT.ARROW) { > Rectangle rect = item.getBounds (); > Point pt = new Point (rect.x, rect.y + rect.height); > pt = toolBar.toDisplay (pt); > menu.setLocation (pt.x, pt.y); > display.asyncExec(()->menu.setVisible (true)); > } > }); > toolBar.pack (); > shell.pack (); > shell.open (); > while (!shell.isDisposed ()) { > if (!display.readAndDispatch ()) display.sleep (); > } > menu.dispose (); > display.dispose (); >} >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 505992
: 268963