Quick question on "World" in Morphic, etc.

wirth at almaden.ibm.com wirth at almaden.ibm.com
Mon Jan 4 09:52:00 UTC 1999



Dan,

In response to my question about building a scrolling form viewer in
Morphic you replied:
----------------------------------------
Open a morphic project, and a workspace therein.
....
Paste the following into your worksapce, and execute it...

    World primaryHand attachMorph:
        (BackgroundMorph new addMorph: (ImageMorph new grabFromScreen))

This will prompt you to select some part of the screen, and you could grab
the above image or anything else that you fancy.  When you're done
selecting the image, you will have a small BackgroundMorph stuck to your
"hand".  Find some appropriate part of the screen an lay it down simply by
clicking there.  The BackgroundMorph has as its only job to continually
tile and scroll its content (think Sat morning cartoon background during a
chase scene)...
----------------------------------------

Looking at BackgroundMorph's methods is very interesting and useful.
Thanks for the advice.  But I wasn't able to use your code as written -- I
couldn't evaluate "World" (or any variant of it that I tried) in the
workspace.  I ended up creating an EllipseMorph and attaching a script to
it that started:
     self costume world ...
to get ahold of the top-level WorldMorph, and then proceeding with your
"primaryHand..."

This leads me to several questions:

1) What can I use in a workspace embedded in a morphic world to refer to
the world?

2) My script on the ellipse leads me to believe that "self" in any script
on a morphic object is really the Player object, the costume of which is
the morphic view.  Is this correct?

3) In Morphic, are there always paired Players and Morphs (like models and
views)?  Can a Player have more than one Morph?


4)  What's the namespace used by the workspace embedded in a morphic world,
i.e., is there a Project globals dictionary?  I noticed that I could
execute assignments to undeclared variables, e.g., "foo := ...", in the
workspace without complaint and retrieve their values later.  Where are
these associations stored?

Thanks,

Mike





More information about the Squeak-dev mailing list