On Sun, Apr 06, 2008 at 04:21:27AM +0100, pedro mg wrote:
> - no longer got events working for the edit_box (responsible for the char
> length to be decremented, and change :stroke color);
Okay, let's talk about that code. It's like this:
@i_say = edit_box do
keypress do |k|
# ...
end
end
This code isn't what you're looking for. The `keypress` method adds
a keypress handler. So you're adding a new keypress handler every
time someone types in the edit box.
@i_say = edit_box do
@remaining.replace string_alert
if @remaining.text[-1] == ?\n
upandaway
end
end
That's more what you're looking for. The edit_box block is called
every time the edit_box is altered. It's just a shortcut for:
@i_say = edit_box
@i_say.changed do
# ...
end
_why