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

Steve Quezadas steveeq1 at gmail.com
Mon Feb 24 20:52:37 EST 2020


Ben,

I checked, [Form] is inherited from class [DisplayMedium]. So in
smalltalk, the inheritence pattern is:
Object -> DisplayObject -> DisplayMedium -> Form

The inheritence pattern of ImageMorph is:
Object -> Morph -> ImageMorph

One does not inherit the other and is not a wrapper, at least in Pharo8

On Sun, Feb 23, 2020 at 10:11 PM Ben Coman <btc at openinworld.com> wrote:

> 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/362f01b6/attachment.html>


More information about the Pharo-users mailing list