[BUG] StringMorph needs textColor inst var and uses color inst var wrongly?

Scott Wallace scott.wallace at squeakland.org
Sat May 4 10:50:18 UTC 2002


Ken,

It's not that objects can't happily mutate on the fly in Squeak -- 
that happens all the time.  It's very common for people to add 
instance variables to classes that have existing instances.  Squeak 
is extremely robust about this.

The problem, rather, is more likely to be that the code you wrote in 
your modified StringMorph drawOn: method raised an error.

Because StringMorphs are used in the title bars of System Windows, 
every attempt to report this error -- or any error -- will result in 
a fresh error (since a pre-debug Notifier is itself a SystemWindow, 
and hence needs to have a StringMorph drawn in its title bar.) 
That's probably why your image ran away from you.

   -- Scott


At 4:44 PM -0500 5/3/02, Ken Causey wrote:
>/me replies to himself.
>
>So okay, I decide to play with fixing this.  Add an inst var of
>textColor, add lazy init getter and setter.  Modify drawOn: and whoops!
>my image is locked and alt-. doesn't help.  Clearly I've swept the rug
>out from under a host of existing StringMorphs in my image.
>
>So, how do I go about making this sort of change?  I can't at the moment
>see how to modify the image and not having StringMorph instances active.
>
>Ken
>
>On Fri, 2002-05-03 at 16:09, Ken Causey wrote:
>>  I'm playing around and try some code like:
>>
>>  (s _ SystemWindow labelled: 'Boogah')
>>	openInHand.
>>  s addMorph: (StringMorph new
>>		contents: 'Comments:';
>>		color: Color black)
>>	frame: (0 at 0.0 corner: 1 at 0.2).
>>
>>  And I don't see any StringMorph in the window.  I start looking around
>>  and find that the color is set to transparent.  Which would be find
>>  except that StringMorph uses color as it's text color, not the primary
>>  (i.e. background) color.  Seems to be this is incorrect.  Shouldn't
>>  there be a textColor attribute used as the color to draw the text and
>  > color be used as the background color?
>  >
>  > Ken
>  >
>  >




More information about the Squeak-dev mailing list