[Cuis-dev] #color: message not honored for button in a SystemWindow
Gerald Klix
cuis.01 at klix.ch
Sun Oct 17 02:06:24 PDT 2021
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
More information about the Cuis-dev
mailing list