Hi Vanessa!
Thanks! =) This works in a workspace,
"Create a SimpleSwitchMorph with label 'Toggle'
and a SimpleButtonMorph with label 'Flash'.
The button will be placed below the switch."
sm := SimpleSwitchMorph new.
sm openInWorld.
bm := SimpleButtonMorph new.
bm openInWorld.
bm position: bm position + (0@32).
"Three ways of toggling the color of the switch:"
sm toggleState.
bl := [ sm toggleState ].
bl value.
bm target: bl.
bm actionSelector: #value.
bm doButtonAction.
"Two ways of toggling the switch after 1000ms:"
sm addAlarm: #toggleState after: 1000.
bm addAlarm: #doButtonAction after: 1000.
but this doesn't:
bm2 := SimpleButtonMorph new.
bm2 target: bl.
bm2 actionSelector: #value.
bm2 addAlarm: #doButtonAction after: 1000.
What is the right way to add an alarm to a morph that is not shown on
the screen? Also, can I create a new invisible morph every time that I
want to run an alarm? Are they going to be garbage collected?
Thanks in advance!
Eduardo Ochs
http://anggtwu.net/eev-squeak.html