[Cuis-dev] #color: message not honored for button in a SystemWindow

Juan Vuletich juan at jvuletich.org
Tue Oct 19 06:33:49 PDT 2021


On 10/17/2021 6:06 AM, Gerald Klix via Cuis-dev wrote:
>
>
> On 10/17/21 9:51 AM, Hilaire Fernandes via Cuis-dev wrote:
>> Hi,
>>
>> Something annoying I don't understand why:
>>
>>      row addMorph: ((PluggableButtonMorph         model: self action: 
>> #cancel         label: 'Cancel' translated) *color: Theme current 
>> cancelButton*).
>>
>> the color message is not honored, color remains to the default value.
>>
>> Afterward, from an inspector the #color: message is honored.
>>
>> Is it related to the fact these morph are then added to a SystemWindow?
> Absolutely!
>
> Take a look at SystemWindow class>>#open:label:, which sends
> #openInWorld to the newly created system window.
> SystemWindow>>#openInWorld sends #widgetsColor:
> to itself, before sending #openInWorld to super.
> SystemWindow>>#widgetsColor: sends #adoptWidgetsColor:
> to self, which recurses through the morph hierarchy
> to set all widgets' colors to the system window's
> color. To make things a bit "more complicated"
> PluggableButtonMorph overrides #adoptWidgetsColor:
> to mix the system window's color with the theme's
> button color.
> Cuis goes through this complicated rigamarole,
> to provide nice colored browser windows,
> which are still themeable.
>
> The net effect is:
> #color: is honored and than rudely written
> over by the system window. I suggest sub-classing
> PluggableButtonMorph and overriding #adoptWidgetsColor:
> according to your needs and taste.
>
>
> HTH,
>
> Gerald

I'm not really happy with that complexity. If anybody suggest a better 
alternative than these #widgetsColor: and #adoptWidgetsColor: , it would 
be nice.

In any case, you can set the color afterwards, for example, using 
#whenUIinSafeState:

Cheers,

-- 
Juan Vuletich
www.cuis-smalltalk.org
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev
https://github.com/jvuletich
https://www.linkedin.com/in/juan-vuletich-75611b3
@JuanVuletich



More information about the Cuis-dev mailing list