links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
What happens to a dropped morph if the receiving morph doesn't want it?
Last updated at 6:46 pm UTC on 22 February 2017

The default behaviour is for it to do nothing, that is, to sit on top of the receiving morph, but without interacting with it. A more intuitive behavior is for the dropped morph to go back to its original position. This can be achieved by the receiver answering true to the message repelsMorph:event: when it doesn't want the dropped morph:

 ReceiverMorph >> repelsMorph: aMorph event: anEvent
	^ (self wantsDroppedMorph: aMorph event: anEvent) not

If the dropped morph should not go back to its original position but stay attached to the hand (cursor) an additional method has to be implemented:

 DroppedMorph >> rejectDropMorphEvent: anEvent
	| h |
	h := anEvent hand.
	WorldState addDeferredUIMessage: [ h grabMorph: self ].
	anEvent wasHandled: true

Continue Drag and Drop (PBE)