Community
Participate
Working Groups
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.
PRODUCT VERSION: 0.43
Will revisit after R2.0.
Post 2.0. Re-opening bug reports for review.
Fixed in 3.2 - you must start the drag in the selected text. Otherwise, normal selection occurs.