[fxruby-users] update question
David MacMahon
davidm at astro.berkeley.edu
Sun Jan 18 14:20:59 EST 2009
> ############method a ##########
>
> def press_next
>
> @all=("1".."100").to_a
>
> @button_next.connect(SEL_COMMAND) do
> @all.each do |e|
> ###app.addTimeout(1*1000){@radio1.text=e}
> @radio1.text=e
> 100.times{app.runOneEvent;sleep 0.01}
> end
> end
> end
>
>
> ##########method b##################
>
> def press_next
>
> @all=("1".."100").to_a
>
> @button_next.connect(SEL_COMMAND) do
> @all.each do |e|
> app.addTimeout(1*1000){@radio1.text=e}
> ###@radio1.text=e
> ###100.times{app.runOneEvent;sleep 0.01}
> end
> end
> end
My guess is that method b is setting up 100 timers that will all
expire very close to each other, so close in fact that their effects
are not all seen in individual repaints. What if you add 10 ms to
each successive addTimeout call in method b? (i.e. the first is 1000
+0, the second is 1000+10, ..., the last is 1000+99)?
BTW, how many timers does fox/fxruby support?
Dave
More information about the fxruby-users
mailing list