Squeak+Event+Dependencies: The solution

Stephane Ducasse ducasse at iam.unibe.ch
Tue Oct 1 19:57:40 UTC 2002


Hi all

just to pass the information about how to use event to implement 
dependency mechanism.
I wrote a wiki page 1214 (I fleshed Squeak+Event)
Here how to use event to have a changed, update: behavior. This is the 
way to avoid all these ugly update methods
full of case statements. The dark is losing a bit today.

MyModel>>lifes: aNumber

	  lifes := aNumber.
	  self trigger: #lifesChanged.

MyUI>>initialize

	  super initialize.
	  domain := MyModel new.
   	  domain when: #lifesChanged send: #lifesChanged to: self.

MyUI>lifesChanged

	  lifeDisplay value: domain lifes


Take care the following in for Squeak32 the interface slightly changed 
in 3.3


Other event pages:
*http://minnow.cc.gatech.edu/squeak/2700*
*http://minnow.cc.gatech.edu/squeak/2477*


Have fun. May be now we should get rid of all the update and changed: 
methods. :)

Dr. Stéphane DUCASSE (ducasse at iam.unibe.ch) 
http://www.iam.unibe.ch/~ducasse/
  "if you knew today was your last day on earth, what would you do
  different? ... especially if, by doing something different, today
  might not be your last day on earth" Calvin&Hobbes




More information about the Squeak-dev mailing list