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 46591 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
[patch]
patch
CComboPatch2.txt (text/plain), 5.93 KB, created by
Kevin Barnes
on 2006-07-20 14:09:52 EDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Kevin Barnes
Created:
2006-07-20 14:09:52 EDT
Size:
5.93 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.swt >Index: Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java,v >retrieving revision 1.83 >diff -u -r1.83 CCombo.java >--- Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java 6 Jun 2006 15:38:19 -0000 1.83 >+++ Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java 20 Jul 2006 16:31:14 -0000 >@@ -11,11 +11,37 @@ > package org.eclipse.swt.custom; > > >-import org.eclipse.swt.*; >-import org.eclipse.swt.graphics.*; >-import org.eclipse.swt.events.*; >-import org.eclipse.swt.widgets.*; >-import org.eclipse.swt.accessibility.*; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.SWTException; >+import org.eclipse.swt.accessibility.ACC; >+import org.eclipse.swt.accessibility.AccessibleAdapter; >+import org.eclipse.swt.accessibility.AccessibleControlAdapter; >+import org.eclipse.swt.accessibility.AccessibleControlEvent; >+import org.eclipse.swt.accessibility.AccessibleEvent; >+import org.eclipse.swt.accessibility.AccessibleTextAdapter; >+import org.eclipse.swt.accessibility.AccessibleTextEvent; >+import org.eclipse.swt.events.ModifyListener; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.events.SelectionListener; >+import org.eclipse.swt.graphics.Color; >+import org.eclipse.swt.graphics.Font; >+import org.eclipse.swt.graphics.GC; >+import org.eclipse.swt.graphics.Point; >+import org.eclipse.swt.graphics.Rectangle; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.swt.widgets.Event; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Layout; >+import org.eclipse.swt.widgets.List; >+import org.eclipse.swt.widgets.Listener; >+import org.eclipse.swt.widgets.Menu; >+import org.eclipse.swt.widgets.Shell; >+import org.eclipse.swt.widgets.Text; >+import org.eclipse.swt.widgets.TypedListener; >+import org.eclipse.swt.widgets.Widget; > > /** > * The CCombo class represents a selectable user interface object >@@ -40,7 +66,7 @@ > Shell popup; > Button arrow; > boolean hasFocus; >- Listener listener, filter; >+ Listener listener; > Color foreground, background; > Font font; > >@@ -106,15 +132,12 @@ > return; > } > if (getShell () == event.widget) { >- handleFocus (SWT.FocusOut); >- } >- } >- }; >- filter = new Listener() { >- public void handleEvent(Event event) { >- Shell shell = ((Control)event.widget).getShell (); >- if (shell == CCombo.this.getShell ()) { >- handleFocus (SWT.FocusOut); >+ getDisplay().asyncExec(new Runnable() { >+ public void run() { >+ handleFocus (SWT.FocusOut); >+ } >+ }); >+ > } > } > }; >@@ -122,13 +145,17 @@ > int [] comboEvents = {SWT.Dispose, SWT.Move, SWT.Resize}; > for (int i=0; i<comboEvents.length; i++) this.addListener (comboEvents [i], listener); > >- int [] textEvents = {SWT.KeyDown, SWT.KeyUp, SWT.MenuDetect, SWT.Modify, SWT.MouseDown, SWT.MouseUp, SWT.Traverse, SWT.FocusIn}; >+ int [] textEvents = {SWT.KeyDown, SWT.KeyUp, SWT.MenuDetect, SWT.Modify, SWT.MouseDown, SWT.MouseUp, SWT.Traverse, SWT.FocusIn, SWT.FocusOut}; > for (int i=0; i<textEvents.length; i++) text.addListener (textEvents [i], listener); > > int [] arrowEvents = {SWT.Selection, SWT.FocusIn}; > for (int i=0; i<arrowEvents.length; i++) arrow.addListener (arrowEvents [i], listener); >- >+ >+ Shell shell = getShell (); >+ shell.addListener (SWT.Deactivate, listener); >+ > createPopup(null, -1); >+ setTabList(new Control[] {text}); > initAccessible(); > } > static int checkStyle (int style) { >@@ -282,8 +309,6 @@ > } > Shell shell = getShell (); > shell.removeListener (SWT.Deactivate, listener); >- Display display = getDisplay (); >- display.removeFilter (SWT.FocusIn, filter); > popup = null; > text = null; > list = null; >@@ -452,7 +477,6 @@ > if (x + width > displayRect.x + displayRect.width) x = displayRect.x + displayRect.width - listRect.width; > popup.setBounds (x, y, width, height); > popup.setVisible (true); >- list.setFocus (); > } > /* > * Return the lowercase of the first non-'&' character following >@@ -687,12 +711,6 @@ > if (hasFocus) return; > if (getEditable ()) text.selectAll (); > hasFocus = true; >- Shell shell = getShell (); >- shell.removeListener (SWT.Deactivate, listener); >- shell.addListener (SWT.Deactivate, listener); >- Display display = getDisplay (); >- display.removeFilter (SWT.FocusIn, filter); >- display.addFilter (SWT.FocusIn, filter); > Event e = new Event (); > notifyListeners (SWT.FocusIn, e); > break; >@@ -700,12 +718,9 @@ > case SWT.FocusOut: { > if (!hasFocus) return; > Control focusControl = getDisplay ().getFocusControl (); >- if (focusControl == arrow || focusControl == list || focusControl == text) return; >+ if (focusControl != list && focusControl != popup) dropDown(false); >+ if (focusControl == arrow || focusControl == text || focusControl == list || focusControl == popup) return; > hasFocus = false; >- Shell shell = getShell (); >- shell.removeListener(SWT.Deactivate, listener); >- Display display = getDisplay (); >- display.removeFilter (SWT.FocusIn, filter); > Event e = new Event (); > notifyListeners (SWT.FocusOut, e); > break; >@@ -1392,13 +1407,23 @@ > } while (index < length); > return string; > } >-void textEvent (Event event) { >+void textEvent (final Event event) { > switch (event.type) { >- case SWT.FocusIn: { >- handleFocus (SWT.FocusIn); >+ case SWT.FocusIn: >+ case SWT.FocusOut: { >+ getDisplay().asyncExec(new Runnable() { >+ public void run() { >+ handleFocus (event.type); >+ } >+ }); >+ > break; > } > case SWT.KeyDown: { >+ if (event.character == SWT.ESC) { >+ // Escape key cancels popup list >+ dropDown (false); >+ } > if (event.character == SWT.CR) { > dropDown (false); > Event e = new Event ();
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 19396
:
21766
| 46591