A Simple Components Example

Mark Guzdial guzdial at cc.gatech.edu
Wed Mar 24 14:48:53 UTC 1999


With thanks from Andrew and Helge, I got an example Morphic Components
project to work.

The error that I was getting about "Attempt to execute an already executing
block" was because I was starting with a fresh 2.3 image.  It was trying to
get my initials!  Once my initials were input, the error went away.

So, here's the simplest example I could come up:
- Create a ComponentLayout morph (in Morphic, New Morph, Components,
ComponentLayout).
- Create a PrintComponent, a TextComponent, and a FunctionComponent, and
drag all three into the ComponentLayout.
- Not necessary but looks good: Put the TextComponent in upper left,
FunctionComponent in center, and PrintComponent in the lower right.
- For ease of pin manipulation, set the scrollbars on all three components
to inboard (available from the Red Halo menu).
- Shift-click on the TextComponent pin, and drag the yellow handle to the
input (leftside) pin on the function component.
- Shift-click on the output pin (bottom) of the FunctionComponent and drag
to the PrintComponent input.
- Now, type a 12 (or any number) in the TextComponent and accept (Enter or
Command-S works on Macs).
- In the FunctionComponent type "a asString asNumber factorial" then
accept.  If all goes well, the result of 12 factorial should appear in the
PrintComponent piece.

One of the problems I was having is that the output of a TextComponent is a
Text -- not a string, not a number.  That's why the conversions in there.

Mark

--------------------------
Mark Guzdial : Georgia Tech : College of Computing : Atlanta, GA 30332-0280
(404) 894-5618 : Fax (404) 894-0673 : guzdial at cc.gatech.edu
http://www.cc.gatech.edu/gvu/people/Faculty/Mark.Guzdial.html





More information about the Squeak-dev mailing list