Bug 4509 - Can't select text in Text Widget if drag and drop enabled (1FUSUI0)
Summary: Can't select text in Text Widget if drag and drop enabled (1FUSUI0)
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.0   Edit
Hardware: All Windows All
: P4 normal with 1 vote (vote)
Target Milestone: 3.2 M4   Edit
Assignee: Veronika Irvine CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-11 14:18 EDT by Veronika Irvine CLA
Modified: 2006-01-20 12:07 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Veronika Irvine CLA 2001-10-11 14:18:03 EDT
When you hook DragDetect in a Text widget and start dragging on receiving this event, you can no longer
select text in the Text widget.  The DragDetect event should not be sent if selection is happening.

In Smalltalk they use :	
	hasNoSelectionProcessing
			"Private - Answer true if mouse selection interferes with drag and drop."
		^true


import com.ibm.swt.dnd.*;
import com.ibm.swt.*;
import com.ibm.swt.layout.*;
import com.ibm.swt.widgets.*;

public class PR1FUSUI0 {
public static void main (String [] args) {
	Shell shell = new Shell ();
	shell.setLayout(new FillLayout());

	final Text text = new Text(shell, SWT.MULTI);
	int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
	final DragSource dragSource = new DragSource(text, operations);
	dragSource.setTransfer(new Transfer[]{TextTransfer.getInstance()});			
	DragSourceListener listener = new DragSourceListener() {
		public void dragSetData(DragSourceEvent event){
			event.data = text.getSelectionText();
		}
		public void dragFinished(DragSourceEvent event){
		}
	};
	dragSource.addDragListener(listener);
	
	text.addListener(SWT.DragDetect, new Listener() {
		public void handleEvent(Event e){
			dragSource.startDrag();
		};
	});
		
	shell.open ();

	Display display = shell.getDisplay ();
	while (!shell.isDisposed ()) {
		if (!display.readAndDispatch ()) display.sleep ();
	}
}

NOTES:

	McQ (27/02/2001 10:22:47 AM) -
		We need to support both drag select and D&D on text widgets.
Comment 1 DJ Houghton CLA 2001-10-29 16:18:11 EST
PRODUCT VERSION:

0.43

Comment 2 Veronika Irvine CLA 2002-05-27 16:14:01 EDT
Will revisit after R2.0.
Comment 3 Veronika Irvine CLA 2002-09-10 10:18:54 EDT
Post 2.0. Re-opening bug reports for review.
Comment 4 Veronika Irvine CLA 2006-01-20 12:07:24 EST
Fixed in 3.2 - you must start the drag in the selected text.  Otherwise, normal selection occurs.