[MCP] [Q] Color change notification

diegogomezdeck at consultar.com diegogomezdeck at consultar.com
Tue Mar 18 17:57:33 UTC 2003


Let me try to explain our original idea/proposal to avoid posible
misunderstandings.

There are a lot of re-definitions of Morph>>color: to update some state
based on the new color.

We want to modify Morph>>color: to something like that.

  Morph>>color:
    "comment"
    <old code>

    self onColorChange.


  Morph>>onColorChange
    "the receiver just changed the color"

    ^ self

Every morph that need to make something when the color change, just re-
implement #onColorChange without changing #color:

We don't want to change (at least now) the current change notification
(Morph>>changed and related).

There are diferent options:

  onColorChange  --->  Without parameters and the implementor has to
use "self color"

  onColorChanged:aColor  --->  With the new color

  onColorChangedFrom:oldColor to:currentColor  --->  Previous and current
colors


We're using Morph>>color: just as an example.  The same idea can be aplied
to #extend: #borderWidht: #borderColor: etc

Cheers,

Diego Gomez Deck





More information about the Squeak-dev mailing list