Bug 389587 - Combo has no event for user-mutation of text (but not selections from drop-down)
Summary: Combo has no event for user-mutation of text (but not selections from drop-down)
Status: CLOSED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.7.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2012-09-14 05:34 EDT by David North CLA
Modified: 2019-02-08 14:23 EST (History)
1 user (show)

See Also:


Attachments
Code demonstrating the problem (2.57 KB, text/x-java)
2012-09-14 05:34 EDT, David North CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.