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 21766 Details for
Bug 19396
[CCombo] CCombo dropdown causes Shell to lose Focus
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Sample technique without flashing
ComboTest.java (text/plain), 4.69 KB, created by
Chris Gross
on 2005-05-25 14:57:20 EDT
(
hide
)
Description:
Sample technique without flashing
Filename:
MIME Type:
Creator:
Chris Gross
Created:
2005-05-25 14:57:20 EDT
Size:
4.69 KB
patch
obsolete
>import org.eclipse.swt.SWT; >import org.eclipse.swt.events.MouseEvent; >import org.eclipse.swt.events.MouseListener; >import org.eclipse.swt.events.SelectionEvent; >import org.eclipse.swt.events.SelectionListener; >import org.eclipse.swt.events.ShellEvent; >import org.eclipse.swt.events.ShellListener; >import org.eclipse.swt.layout.FillLayout; >import org.eclipse.swt.layout.GridLayout; >import org.eclipse.swt.widgets.Button; >import org.eclipse.swt.widgets.Display; >import org.eclipse.swt.widgets.Label; >import org.eclipse.swt.widgets.List; >import org.eclipse.swt.widgets.Shell; > >public class ComboTest { > > MyPopup popup; > > public static void main (String [] args) { > Display display = new Display(); > Shell shell = new ComboTest().open(display); > // Event loop > while (shell != null && ! shell.isDisposed()) { > if (! display.readAndDispatch()) display.sleep(); > } > // Cleanup > display.dispose(); > > } > > > public Shell open(Display d){ > Shell shell = new Shell(); > createPartControl(shell); > > shell.pack(); > shell.open(); > return shell; > } > > public void createPartControl(final Shell shell){ > GridLayout gl = new GridLayout(2,false); > gl.marginHeight = 10; > gl.marginWidth = 10; > shell.setLayout(gl); > > final Label l = new Label(shell,SWT.NONE); > l.setText("Nothing Selected"); > l.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); > > final Button b = new Button(shell,SWT.ARROW | SWT.DOWN); > > > b.addSelectionListener(new SelectionListener(){ > public void widgetSelected(SelectionEvent arg0) { > showPopup(shell,l); > } > public void widgetDefaultSelected(SelectionEvent arg0) { > }} > ); > > } > > public void showPopup(Shell parentShell,Label l){ > if (popup == null){ > popup = new MyPopup(parentShell,l); > } > > popup.show(l); > > } > > > private class MyPopup { > > Shell shell; > List list; > Shell parentShell; > Label label; > > public MyPopup(Shell arg0,Label arg1) { > shell = new Shell(arg0,SWT.TOOL); > > parentShell = arg0; > parentShell.addShellListener(new ShellListener(){ > public void shellActivated(ShellEvent arg0) { > } > public void shellClosed(ShellEvent arg0) { > } > public void shellDeactivated(ShellEvent arg0) { > if (!shell.isDisposed()) > Display.getCurrent().asyncExec(new Runnable(){ > public void run() { > shell.setVisible(false); > }} > ); > } > public void shellDeiconified(ShellEvent arg0) { > } > public void shellIconified(ShellEvent arg0) { > }} > ); > > label = arg1; > > shell.setLayout(new FillLayout()); > > list = new List(shell,SWT.NONE); > > list.addMouseListener(new MouseListener(){ > public void mouseDoubleClick(MouseEvent arg0) { > } > public void mouseDown(MouseEvent arg0) { > list.setCapture(false); > parentShell.setActive(); > if (list.getBounds().contains(arg0.x,arg0.y)){ > try { > Display.getCurrent().getThread().sleep(200); > } catch (InterruptedException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > label.setText(list.getSelection()[0]); > } > shell.setVisible(false); > } > public void mouseUp(MouseEvent arg0) { > }} > ); > > > list.add("Item 1"); > list.add("Item 2"); > list.add("Item 3"); > list.add("Item 4"); > > shell.setSize(100,100); > } > > public void show(Label l) { > shell.setLocation(l.toDisplay(l.getLocation())); > shell.setVisible(true); > list.setCapture(true); > > } > > } >}
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 19396
: 21766 |
46591