[Cuis-dev] Greetings and a couple of questions from a newbie

David Gouge davidgouge at pm.me
Sun Feb 15 15:33:50 PST 2026


Hi Ken,

Thanks for the quick response! You're explanation of the code is indeed very helpful. It's going to take me a while to stop thinking in C++ lingo. I'm an old dog and like they say... We take a while to learn new tricks.

Let me state my observation in a simpler way:

Using the older Cuis University image, 1) I can copy that example code into a Workspace. 2) doIt 3) Enter my name in the text field and 4) press the Greet button. Everything works fine in the older image.

Using the newer rolling release image, I do the same thing and it halts after the button press and brings up the debugger.

In the older image (which works properly) the LabelMorph >> contents:newContents selector did not try to set it's own color instantance var to be the same as newContents colorAt: 1. This appears to be a newer modification to the LabelMorph>>contents: implementation. Using the example in the new image, newContents colorAt: 1 evaluates to nil which in turn causes the LabelMorph>> onDraw message to send aCanvas >>drawString:at:font:color a nil for the color. This is where it halts in the debugger.

I guess that I was just wanting to know if it would be idiomatic to test for nil before the assignment of color in the LabelMorph>>contents selector. In my C++ mind it would indeed be idiomatic and not doing so would be a bug. Just trying to learn how you smalltalk'ers think.

Thanks for your help on this!
-Dave

Sent from Proton Mail for Android.

-------- Original Message --------
On Sunday, 02/15/26 at 14:15 ken.dickey--- via Cuis-dev <cuis-dev at lists.cuis.st> wrote:
On 2026-02-15 09:52, David Gouge via Cuis-dev wrote:

> In the code example, the greetingLabel instance is explicitly sent the
> 'color: Color: red' message after creation.

Quick note:

  <greetLabel> color: Color red

Should work.  #Color: is not a selector.  #Color (no colon) refers to
the Color class.

Syntax highlighting in the Workspace window should clue here.

I note that LabelMorph>>contents: checks for and handles #Text.

The 'Color red' invokes the Color>>red method [Browse _Class_ Color,
method #red].

HTH,
-KenD
--
Cuis-dev mailing list
Cuis-dev at lists.cuis.st
https://lists.cuis.st/mailman/listinfo/cuis-dev



More information about the Cuis-dev mailing list