Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 389587

Summary: Combo has no event for user-mutation of text (but not selections from drop-down)
Product: [Eclipse Project] Platform Reporter: David North <dtn-eclipsebugs>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: ericwill
Version: 3.7.2Keywords: triaged
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Code demonstrating the problem none

Description David North CLA 2012-09-14 05:34:45 EDT
Created attachment 221074 [details]
Code demonstrating the problem

See the attached sample code.

I want to call the method userSelectedSomething when the user picks an entry from the combo's drop-down list. This is easily accomplished with addSelectionChangedListener.

I want to call the method userTypedOrOtherwiseEditedText exactly when the user has typed into the combo or used the right-click cut/paste/delete options to modify the text.

This seems to be impossible. The closest I can get is listening to SWT.Modify events, but these are also triggered when a selection is made from the list.

Listening to SWT.KeyUp, plus treating the next modify event after the right-click menu has been opened as a user edit, gets me 90% of the way there, but is still wrong if the user raises and dismisses the right-click menu without using cut, paste or delete.

Please can an event for text edits be added.

(See http://stackoverflow.com/questions/12410636/swt-differentiating-between-selection-and-typing-in-a-combo for background)
Comment 1 David North CLA 2012-09-14 06:45:10 EDT
(In reply to comment #0)

> Listening to SWT.KeyUp, plus treating the next modify event after the
> right-click menu has been opened as a user edit, gets me 90% of the way
> there, but is still wrong if the user raises and dismisses the right-click
> menu without using cut, paste or delete.

This is actually broken in other ways too: if the user selects items from the list with the up/down arrow keys, the KeyUp listener incorrectly fires the userTypedOrOtherwiseEditedText method.
Comment 2 Eric Williams CLA 2018-11-30 11:31:47 EST
Do you have an SWT snippet (no JFace) to reproduce this issue?
Comment 3 Eric Williams CLA 2019-02-08 14:23:39 EST
(In reply to Eric Williams from comment #2)
> Do you have an SWT snippet (no JFace) to reproduce this issue?

No response in awhile, closing this ticket. Please reopen if able to provide a pure SWT snippet to reproduce the issue with.