Bug 4655 - DCR - Text control does not fire selection event (1GDW107)
Summary: DCR - Text control does not fire selection event (1GDW107)
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.0   Edit
Hardware: All Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Steve Northover CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
: 176374 (view as bug list)
Depends on:
Blocks:
 
Reported: 2001-10-11 14:20 EDT by Simon Arsenault CLA
Modified: 2022-02-11 14:26 EST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Arsenault CLA 2001-10-11 14:20:43 EDT
I add a SelectionListener using Text::addSelectionListener() but it
	never fires when text is selected (via the mouse or keyboard). The
	documentation states it fires this selection event. Is this a bug with
	Text or something that is not supported and the doc is just out-of-date.

	Please let me know as soon as you can because we'll need to find
	a workaround in our code (if it's possible) or document it as a know
	issue.

	Here is a small example to show the event not firing

public static void main(String[] args) {
	Display display = new Display();
	Shell shell = new Shell(display);
	shell.setLayout(new GridLayout());
	final Text field = new Text(shell, SWT.SINGLE);

	field.addSelectionListener(new SelectionAdapter() {
		public void widgetDefaultSelected(SelectionEvent e) {
			System.out.println("default selection");
		}
		public void widgetSelected(SelectionEvent e) {
			System.out.println("selection");
		}
	});
	
	shell.open();
	while (shell != null && !shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep(); 
	} 	
}

NOTES:

SN (5/17/01 6:28:23 PM)
	It never did because there is no support in the OS for this.  The StyledText added this
	callback and supported it.  However, the double selection callback does work in the
	case of a single line text widget when you hit return.

	Changing PR to a DCR.

	McQ (28/05/2001 2:14:00 PM) -
		Not for June.

	McQ (26/06/2001 1:39:21 PM) -
		It's now called "DefaultSelection".

	McQ (26/06/2001 1:40:00 PM) -
		Document that selection in text widget should not be Selection.
Comment 1 DJ Houghton CLA 2001-10-29 16:28:39 EST
PRODUCT VERSION:
	0.107 (on Windows 2000, may also happen on other platforms)

Comment 2 Steve Northover CLA 2002-02-08 09:14:58 EST
Need to either document or implement.
Comment 3 Mike Wilson CLA 2002-02-08 13:57:27 EST
If StyledText supports this, then implement it for Text. See SN for info if 
required. If StyledText does not support it, then update the documentation.
Comment 4 Morten Moeller CLA 2005-10-26 12:39:50 EDT
I realize this bug is ancient and the javadoc actually does warn you that 
selection does nothing on Text. 
 
But this is inconsistent and annoying (I can't find another way of listening to 
selection changes in a text field; for example to enable/disable context menu 
options).  
 
Could this be considered for 3.2? 
 
Comment 5 Steve Northover CLA 2005-10-26 12:54:48 EDT
There is no support in the native Windows text control for this feature.  
That's what is holding this up.
Comment 6 Grant Gayed CLA 2007-03-05 10:51:59 EST
*** Bug 176374 has been marked as a duplicate of this bug. ***
Comment 7 Eclipse Webmaster CLA 2019-09-06 16:07:50 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.
Comment 8 Eclipse Genie CLA 2022-02-11 14:26:56 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.