Window colours

Ned Konz ned at squeakland.org
Tue Mar 1 18:09:44 UTC 2005


On Tuesday 01 March 2005 8:51 am, Frank Shearar wrote:
> Is it better form to override #defaultBackgroundColor or to "Preferences
> setWindowColorFor: Foo name to: someColor" in Foo class>>initialize?
>
> In the latter case, we'd of course call "Preferences windowColorFor: self
> class name" in our Foo>>openWindowTypeOfMethod.

You shouldn't override defaultBackgroundColor.

And there's no reason to do a setWindowColorFor:to: if you put a 
#windowColorSpecification in the class side of the model class. In fact, 
doing a #setWindowColorFor:to: is rude, as it overrules the user's own window 
color settings.

In the case of a SystemWindow without a separate model, just make the model of 
the window itself, and then provide a #windowColorSpecification as above.

The window opening (assuming you're opening a SystemWindow) will look up the 
window color itself. If you're getting a color for a non-SystemWindow, you 
would do it as you describe.

The default window color (that is, for things with a nil model or no 
windowColorSpecification in their model class), by the way, could stand to be 
something with a little more contrast.

-- 
Ned Konz
http://bike-nomad.com/squeak/



More information about the Squeak-dev mailing list