Project: SWT
Bug 299302 Cannot Uppercase text CCombo in VerifyListener
Reported: 2010-01-11 12:49:06 | Status: resolved fixed

Build Identifier: 20090920-1017 When a user types characters in a CCombo, I would like those characters to be forced into upper case. In a Text field this is accomplished by adding a VerifyListener. The event handling code for CCombo does not allow the listener to override the text in the verify event. This is a simple fix, the method "CCombo.textEvents()" needed to be modified for the VerifiedEvent to add "event.text = e.text" after the listeners have been notified as follows: case SWT.Verify: { Event e = new Event (); e.text = event.text; e.start = event.start; e.end = event.end; e.character = event.character; e.keyCode = event.keyCode; e.stateMask = event.stateMask; notifyListeners (SWT.Verify, e); event.doit = e.doit; event.text = e.text; break; } Reproducible: Always Steps to Reproduce: 1. Add a VerifyListener to a CCombo that is editable. 2. Uppercase the event text in the verify Listener. 3. Text in the Combo box is not uppercased.

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java