[Pharo-users] What is the difference between a form and a morph?

Ben Coman btc at openinworld.com
Mon Feb 24 01:10:50 EST 2020

On Mon, 24 Feb 2020 at 04:31, Steve Quezadas <steveeq1 at gmail.com> wrote:

> I usually like to go through the source code to answer my own question,
> but I can't tell by reading it.
> [Morph], from what I understand, deals with manipulating graphics on
> smalltalk. But when I use ZnEasy to get a jpeg file, I notice that it
> returns a [Form] and not a [Morph] to display a jpeg. Spec2 also wants
> [Form] for displaying images rather than [Morph].
> So what is the difference between a [Form] and a [Morph] since they both
> seem to deal with graphics?

I don't know the exact answer, but if you review method ImageMorph>>form
you will see that the ImageMorph is a wrapper around a Form.

So some simple differences that may be inferred.
- Many morphs are not bitmaps.
- Morphs are GUI elements, i.e. interact with mouse and keyboard
- Forms are not GUI elements
- Forms can be manipulated without displaying them.

In some other graphics system, an analogy could be putting an image on a
button and asking "what is the difference between an 'image' and a 'button'

wrt Spec2, Morph is one backend that Spec2 might use to display a Form,
or Spec2 might display the Form using a GTK widget.

cheers -ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20200224/f8232548/attachment.html>

More information about the Pharo-users mailing list