Another stupid Morphic Question

Jerome Peace peace_the_dreamer at yahoo.com
Wed May 2 01:05:47 UTC 2007


Hi Andrew,

Just wanted to point you to my previous reply

http://lists.squeakfoundation.org/pipermail/squeak-dev/2007-May/116371.html


And I found some of my wip code that my serve as a
good example and placed it on bob's superswiki here:

http://209.143.91.36/super/728
aka
http://209.143.91.36/super/MovingPiece-wiz

Its in the form of a project meant to work in 3.9
(7067).

HTH.

Yours in curiosity and service, --Jerome Peace



***
>  
>   	
>  Another stupid Morphic Question
>  Andrew P. Black black at cs.pdx.edu 
>  Tue May 1 16:03:44 UTC 2007 wrote:

>  
>  On 1 May 2007, at 1:07, Andreas Raab wrote:
>  
>  > ... it's the world which implements the default
>  behavior of  
>  > dragging objects. In other words the action is
>  contextual (objects  
>  > in the world can be dragged) not builtin.
>  
>  Aha!  This was an insight that I was missing. 
Someone
>  should write a  
>  book that explains all this stuff ;-)
> 
Why not start a wiki page.

You can either copy from the mail or use hypertext to
point to the relevant emails in the archive.

 
>  > This code seems both overly complicated as well
as at
>  least  
>  > somewhat buggy (grabMorph:from: should only be
used
>  for owner-less  
>  > morphs). Try the following instead:
>  >
>  > rect := RectangleMorph new.
>  > rect extent: 100 at 100.
>  > circle := EllipseMorph new.
>  > circle extent: 100 at 100.
>  > rect addMorphCentered: circle.
>  > rect on: #mouseDown send: #value to:["ignore
drags"].
>  > circle on: #mouseDown send: #value
>  >        to:[circle world primaryHand grabMorph:
>  circle].
>  > rect openInWorld.
>  
>  Well, this is much more elegant: the use of
on:send:to:
>  simplifies  
>  things considerably, and, along the way, explains
how
>  to use  
>  EventHandlers, which were another mystery.  But it
has
>  the same bug:  
>  once the circle has been "picked up", it is no
longer a
>  submorph of  
>  the rectangle.  Presumably that could be fixed by a
>  #mouseUp handler,  
>  although I tried adding
>  
>  circle on: #mouseUp   send: #value
>          to:[rect addMorph: circle].
>  
>  which appeared to have no effect.
>  >
>  >> I could probably find all of the bits of code
that I
>  need, to  
>  >> handle mouse move and so on, taking care of the
>  offset between  
>  >> mouse click event and the origin of the Morph
that
>  I'm moving —  
>  >> most of the code must be in HaloMorph.  But this
was
>  the Default  
>  >> Behavior of the circle before I embedded it in
the
>  rectangle —  
>  >> surely there must be an easier way to get that
>  default behavior  
>  >> back, other than duplicating the code from
whereever
>  it is hidden!
>  >
>  > Well, by far the easiest way is to use a
PasteUpMorph
>  instead of a  
>  > RectangleMorph - PasteUps have this behavior
builtin.
>  
>  That is the answer I was looking for!  Inter alia,
it
>  explains what a  
>  PasteUpMorph is for, somthing that I had never
>  appreciated (except to  
>  know that the World was one).
>  
>  Thank you!
>  
>  Andrew P. Black
>  Department of Computer Science
>  Portland State University
>  +1 503 725 2411
>  
> 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Squeak-dev mailing list