Color problem for PluggableButtonMorph

Hernan Tylim htylim at yahoo.com.ar
Sun Dec 18 17:17:33 UTC 2005


One of SystemWindow responsibilities is to keep the window color theme, and
because of that SystemWindow needs to set and override the colors of all its
direct submorphs.

When you add a morph to a SystemWindow in #addMorph:frame: the color of the
submorph will be set to the color of the Window pane color. Also, when you
change the window's color, it will change the color of all this submorphs to
match the new one from the window.

To avoid SystemWindow to do that there is a 'hack'. Wrap the button that you
want to insert with another Morph. Because SystemWindow *only* change the
color of its direct submorphs it wont touch your button's color.

Other alternative, if you are subclassing from SystemWindow, is for you to
set the color of your button *after* you add it to the SystemWindow. And
also *after* each time SystemWindow>>setWindowColor: is called.

What I usually do is just insert a bit top level morph as direct descendant
of SystemWindow and make all my morphs submorphs of this pane.

Regards,
Hernán


> -----Original Message-----
> From: squeak-dev-bounces at lists.squeakfoundation.org 
> [mailto:squeak-dev-bounces at lists.squeakfoundation.org] On 
> Behalf Of Hilaire Fernandes
> Sent: Sunday, December 18, 2005 1:12 PM
> To: The general-purpose Squeak developers list
> Subject: Re: Color problem for PluggableButtonMorph
> 
> Is the same happening if you move the button color: Color 
> brown message
> after opening in the display your SystemWindow?
> I have also seen strange things depending on when you set your message
> (after or before an openInDisplay message)
> 
> 
> Robert Hawley a écrit :
> > In an application using SystemWindow I am trying to set the 
> colour of a PluggableButtonMorph.  When I run the 
> application, the button initially displays without a color 
> (i.e., white).  It is only when I click on it that it shows 
> the default color (light green).  It never shows the colour 
> that I am trying to set using ....color: Color brown;.... in 
> my 'open' method.
> > 
> > It seems to me that if I specify a color when I create the 
> PluggableButtonMorph then the other code in SystemWindow 
> ought not to override that perference.  Is this fixable?
> > 
> > [Notes: The case I am describing is not using 
> onColor:offColor: option. The behaviour still applies if I 
> switch off alternativeWindowLook. I'm using 3.8.]
> > 
> > 
> 
> 





More information about the Squeak-dev mailing list