[squeak-dev] Re: Drag-drop in Morphic; updating old code
Marcel Taeumel
marcel.taeumel at student.hpi.uni-potsdam.de
Sun Jul 28 08:13:42 UTC 2013
Hi, Tim!
1. Once a morph receives an event, it can reject it due to some general
conditions. This is not specific to but includes drop events. The default
implementation of #rejectsEvent: considers visibility and locked state of
the receiving morph.
2. The default event dispatcher tries to dispatch the event on the morph or
any of its submorphs if necessary: Leaves first! It means that the current
morph will get the last chance to process the (drop) event. There are some
mechanisms that override this behavior, e.g. #mouseDownPriority. Drop events
can be rejected for the whole sub-scenegraph with #rejectDropEvent:.
However, you should override #repelsMorph:event: for this purpose.
3. Then, a morph gets the chance to actually handle the drop event.
(Morph>>#handleEvent: resp. DropEvent>>#sentTo: and
Morph>>#handleDropMorph:)
4. Now the methods you should actually implement (besides maybe
#repelsMorph:event:) are:
#wantsDroppedMorph:event:
#wantsToBeDroppedInto:
#acceptDroppingMorph:event:
#justDroppedInto:event:
These are more or less self-explaining. Configuring #dropEnabled does not
control the whole sub-scenegraph but only one specific morph in the
hierarchy.
Maybe, this helps. :)
Best,
Marcel
P.S.: Here is a picture with code:
<http://forum.world.st/file/n4701110/morphic-drop-events.png>
--
View this message in context: http://forum.world.st/Drag-drop-in-Morphic-updating-old-code-tp4700849p4701110.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.
More information about the Squeak-dev
mailing list
|