summaryrefslogtreecommitdiff
path: root/ext/tk/lib/tk/timer.rb
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-07-08 16:50:07 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-07-08 16:50:07 +0000
commit9945dd1adf9eee1f19ea1f7a736e97f74596e9bc (patch)
tree1dfea1caef689bef9a36345bd72000ccd3eb58f8 /ext/tk/lib/tk/timer.rb
parent1909f5f1b14167bc24bcccd1500a27a42551fa95 (diff)
* ext/tk/lib : bug fix
* ext/tk/lib/tkextlib/itcl : add [incr Tcl] support * ext/tk/lib/tkextlib/itk : add [incr Tk] support * ext/tk/lib/tkextlib/iwidgets : midway point of [incr Widgets] support * ext/tk/sample/tkextlib/iwidgets : very simple examples of [incr Widgets] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tk/timer.rb')
-rw-r--r--ext/tk/lib/tk/timer.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/ext/tk/lib/tk/timer.rb b/ext/tk/lib/tk/timer.rb
index aa42c4e..3696de1 100644
--- a/ext/tk/lib/tk/timer.rb
+++ b/ext/tk/lib/tk/timer.rb
@@ -289,13 +289,16 @@ class TkTimer
self
end
- def set_start_proc(sleep, init_proc, *init_args)
+ def set_start_proc(sleep, init_proc=nil, *init_args)
if !sleep == 'idle' && !sleep.kind_of?(Integer)
fail ArguemntError, "expect Integer or 'idle' for 1st argument"
end
@init_sleep = sleep
@init_proc = init_proc
@init_args = init_args
+
+ @init_proc = proc{|*args| } if @init_sleep > 0 && !@init_proc
+
self
end
@@ -306,6 +309,10 @@ class TkTimer
@do_loop = @loop_exec
@current_pos = 0
+ @init_sleep = 0
+ @init_proc = nil
+ @init_args = nil
+
argc = init_args.size
if argc > 0
sleep = init_args.shift
@@ -315,7 +322,9 @@ class TkTimer
@init_sleep = sleep
end
@init_proc = init_args.shift if argc > 1
- @init_args = init_args if argc > 0
+ @init_args = init_args if argc > 2
+
+ @init_proc = proc{|*args| } if @init_sleep > 0 && !@init_proc
@current_sleep = @init_sleep
@running = true