submorph NOT associate with its original owner after move to different location. And other issues.

Ned Konz ned at bike-nomad.com
Thu Jan 18 07:25:05 UTC 2001


On Wednesday 17 January 2001 15:26, TECHIN.A.KANG at mail.sprint.com wrote:

> Everytime I move the submorph to a new position, it changes its owner to
> WORLD. Anyway I can force the submorph to change owner only when I force
> it to do so?

If you grab a morph with the Hand, the Hand becomes the morph's owner.
If you then drop it on a morph that is open to drag and drop, (one that will
accept the dropped morph), it will become a sub-morph.

So either you were moving the hand's position outside the original owning 
morph's boundaries before you dropped the submorph, or the original morph
does not want to accept the dropped morph. Unfortunately, the decision
about dropped morphs is made by the Hand based on ITS position, not the 
submorph's.

> 1) A morph (say an iconMorph) can associate with many submorph. When I
> move the morph (iconMorph) its submorphs move relative to its owner;
> when I move the submorph, no other objects move along with it. Mean -
> when I re-arrange the iconMorph's submorphs positions, their
> relationship should not be broken.

You can do this to some extent. This is how you move windows about
within a Morphic world, for instance.

Of course, the owning morph may have its own ideas about how to position
its submorphs (they now have alignment behavior built in).

But the concept of dropping and ownership is by default set to physical
inclusion: if you drop a morph with the Hand inside another morph that
wants to have morphs dropped on it, they'll become submorphs.

> 2) 2 morphs can be connected with a curveMorph or something like that.
> (3 morphs in this case?). When I re-arrange their positions, the
> curveMorph redraw to reflect the position change. When I move anyone of
> the two morphs, the 3 objects move in the same direction and maintain
> their relative position.

I did this by having separate Morphs that knew to re-position themselves
and also move the associated curve when the attached objects moved.
Look at my Attachments change set.

> 3) so, I can display a morph's states (instance variables) as submorphs
> depending on their willingness to display or not.
>

Does Morphic Wrappers do this already? I don't know; I've never used it.

> Question B)
> A morph is a concret object as I read from Mr. John Maloney's "An
> introduction to Morph: The Squeak UI Framework". So I think every object
> should have a name and birthday.

every object or every Morph? Not all objects are morphs. You really
don't want to add instance variables to Object. Believe me.

> I tried to add instance variables givenName and birthDay to class
> Object, and got rejected. Why? What is the best resolution to force the
> whole system to assign the time an object was created? I added to Morph
> Class and it works. But, may be my approach may interfere with other
> works.

There is a provision to add arbitrary properties to Morphs; perhaps this will 
do what you want. Of course, the creator of the Morph will have to set
that property.

> Question C)
> A morph world is a collection of morphs. How can I make connections
> among worlds? Like the flow-chart you can have one object its output is
> point to another object at different sheet.

how would you follow that link? You could make an "off-page connector
morph" that activates another Morphic World.

-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com





More information about the Squeak-dev mailing list