Closed tinchodias closed 1 year ago
In general, the whenXXXXDo: pattern leads to this kind of issue. I have to think about it
A possible solution: the button has in initialize:
action := [].
self whenClickedDo: [ action value ]
and it's prepared to somebody that updates the valuable via action:
. And there is a single "official action" of the button.
It could be more efficient to remember in the button the event handler, and that the mutator method updates the block in the event handler. But not sure how much more efficient.
the event handler is now stored so that it can be replaced or removed
This is because whenClickedDo adds a new event handler for click each time. Example:
it pop ups 2 messages each time.