links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Drag and Drop: receiver morph needs to implement 'wantsDroppedMorph:anEvent'
Last updated at 6:16 pm UTC on 22 February 2017


How do we decide if a receiver morph will accept or reject a dropped morph?
In general, both of the morphs will have to agree to the interaction.

The receiver does this by responding to


Its first argument is the dropped morph, and the second the mouse event, so that the receiver can, for example, see if any modifier keys were held down at the time of the drop.

The dropped morph is also given the opportunity to check and see if it likes the morph onto which it is being dropped, by responding to the message wantsToBeDroppedInto:. The default implementation of this method (in class Morph) answers true.

The following example code answers true in case the dropped morph has a blue color

 ReceiverMorph >> wantsDroppedMorph: aMorph event: anEvent
	^ aMorph color = Color blue

Continue: Drag and Drop (PBE)