[goodie] Kids' Refrigerator Magnets [FIX]

Dan Ingalls Dan at SqueakLand.org
Thu Sep 6 05:44:35 UTC 2001


>I love the speaking magnets, what a wonderful idea.

Thanks, Thomas.

>I came across one problem though, which probably is not a problem for the most up to date squeakers but perhaps the issue is nevertheless interesting.
>
>I am not a test pilot so I used Squeak 3.0 and after filing in everything works but after the magnets moved into position (immediately after the initial positioning) letters/numbers become invisible.
>
>The reason for this is that the text color is set to the same color as the background color.
>
>After a bit of tracking I found the culprit in
>
>Morhp>>fillStyle:
>	"Set the current fillStyle of the receiver."
>	self setProperty: #fillStyle toValue: aFillStyle.
>	"Workaround for Morphs not yet converted"
>	"color _ aFillStyle asColor."
>	self changed
>
>The workaround code -- in the case of TextMorphs has the unfortunate effect of setting the text color to the background color as well.
>Removal of the one but the last line fixes the bug.

I think better than to alter Morph, is instead to add this more local change:
---------------
!NCLabelMorph methodsFor: 'visual properties' stamp: 'di 9/5/2001 10:38'!
backgroundFill: aColor
	"LabelMorph forwards color to its label if present.
	We only want to affect the background."

 	super fillStyle: aColor.! !
---------------

This will leave the workaround in place and it should work for both 3.0 and 3.1.

Thanks for trying it out.  I have fixed this problem and have done a better job of changing speakers as you suggest.  I'll incorporate both when I put it out on BSS.

	- Dan
-- 




More information about the Squeak-dev mailing list