[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: problem about SWT drag and drop

There were a couple of problems with this code that you need to fix to make it work.

1) You need to change the condition in the dragFinished code from OR (||) to AND (&&) otherwise the character is removed even when the drop failed.

public void dragFinished(DragSourceEvent event) {
	// Removes the text after the move operation.
	if (event.doit == true && event.detail == DND.DROP_MOVE) {
		label.setText("");
	}
}

2) You need to set the drop target for the bottom row by uncommenting the line:

	setDropTarget(labelRowTwo);

Hopefully, you can unscramble the mystery word after that. :-)