Drag-n-Drop: How to take something back out?

Ned Konz ned at bike-nomad.com
Mon Sep 29 23:49:37 UTC 2003


On Monday 29 September 2003 04:28 pm, Aaron J Reichow wrote:
> Hello everyone!
>
> I'm working on adding drag-n-drop (DnD) capabilities to an app I'm
> writing. (Dynapad's calendar/scheduler)
>
> Adding some simple DnD functionality was pretty easy, but I've run
> into a problem: I can drag-n-drop morphs *into* the reciever of
> these morphs, but I can't take them back out.  That is, I'd like to
> be able to drag the morphs back out of the container, dropping them
> into another container, the trash, etc.  But, after a morph has
> been embedded, it doesn't seem that I can take it back out unless I
> bring up a halo around just that morph, and use the black Pick Up
> handle- not much of an option on a PDA.
>
> I wrote up a smalll DnD example that exibits this same behavior:
> http://www.d.umn.edu/~reic0024/squeak/AJR-DnD.st
>
> I've experimented with a number of messages- #enableDragNDrop,
> #dragEnabled:, #enableDrag:, #enableDrop:, #dropEnabled:, etc.  I'm
> tried changing these settings on both the container and the morphs
> I'd like to drop, but I can't seem to find anything that works.  No
> matter what I try, when I click-and-hold on one of the submorphs
> that have been dropped into the container I'm using, it picks up
> the *whole* morph, that is, the topmost container and everything in
> it.
>
> What am I missing?  What do I need to do to make my submorphs
> draggable after they've been added?

They have to respond to the drag event by initiating the drag 
sequence.

If no morph in the assembly responds to the mouse event, it gets 
passed to the World, whose default is to grab the whole root morph.

m _ Morph new bounds: (100 at 100 extent: 300 at 300); openInWorld.
m enableDrop: true.
s _ Morph new color: Color red; position: 200 at 200.
m addMorph: s.
s on: #startDrag send: #startDrag:with: to: s.

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE



More information about the Squeak-dev mailing list