[MacRuby-devel] Dynamic refresh in a view - xcode 4 / MacRuby

azzzz at gmx.net azzzz at gmx.net
Tue May 24 17:06:03 PDT 2011


I have a label that I have set to blank, and after a user clicks 'go' I generate a random word or number and use:

self.label.stringValue = "some_word"

to update the view.

However, I would like to show 200 or so random words in quick succession before the final one is shown - just because it's too plain at the moment. Alternatively, I'd be happy with showing an animated graphic in its place - which is replaced by the final random word after a few seconds.

I've tried things like:

100.times do
 num = rand(40)
 self.label.stringValue = num
 sleep 1
end

But it doesn't work. I've also (after googling) tried .reloadData but to no avail as well.

Any ideas on how to achieve this? Or pointers on how to add animations to my window/views?


More information about the MacRuby-devel mailing list