[Cuis-dev] question about changing instance variables in an Inspect window

Vanessa Freudenberg vanessa at codefrau.net
Sat Jun 29 17:23:40 PDT 2024


If you simply set the color instance variable, the morph is not redrawn. If
you click the morph after, you will see that it is indeed blue.

The #color: method takes care of both setting the instance variable and
invalidating the morph so it gets redrawn automatically.

Vanessa

On Sat, Jun 29, 2024 at 16:45 Mark Volkmann via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:

> Can someone explain what's going on near the end of this sequence of basic
> steps?
>
> - Open the World menu and select "New Morph...".
> - Select "Basic...Boxed Morph" or really any morph with a background fill
> color.
>   An orange rectangle will appear, attached to the mouse cursor.
> - Move to where you want to place it and click to drop it.
> - cmd-click (macOS) on the morph to open its halo.
> - Click the blue button on the top row.
> - Select "debug...inspect morph" to open an Inspect window
>    for the object that represents that morph.
> - Click the `color` instance variable and note that the value is a `Color`
> object.
> - Click in the bottom pane.
> - Enter `color := Color red` and "Do it".
> - Note that the value of the instance variable in the upper-right pane
> updates to `Color red`,
>   BUT the fill color of the morph does not change.
> - Enter `self color: Color blue` and "Do it".
> - Note that the value of the instance variable in the upper-right pane
> updates to `Color blue`,
>   AND the fill color of the morph changes to blue.
>
> Why does the first approach not update the morph, but the second approach
> does?
> Both update the value of the instance variable inside the Inspect window.
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240629/b5f028e5/attachment.htm>


More information about the Cuis-dev mailing list