diff options
Diffstat (limited to 'ext/tk/lib/tk/canvas.rb')
-rw-r--r-- | ext/tk/lib/tk/canvas.rb | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/ext/tk/lib/tk/canvas.rb b/ext/tk/lib/tk/canvas.rb index 9a042155e3..3bc08e94fc 100644 --- a/ext/tk/lib/tk/canvas.rb +++ b/ext/tk/lib/tk/canvas.rb @@ -94,12 +94,30 @@ class TkCanvas<TkWindow *tags.collect{|t| tagid(t)})) end - def itembind(tag, context, cmd=Proc.new, *args) + #def itembind(tag, context, cmd=Proc.new, *args) + # _bind([path, "bind", tagid(tag)], context, cmd, *args) + # self + #end + def itembind(tag, context, *args) + if args[0].kind_of?(Proc) || args[0].kind_of?(Method) + cmd = args.shift + else + cmd = Proc.new + end _bind([path, "bind", tagid(tag)], context, cmd, *args) self end - def itembind_append(tag, context, cmd=Proc.new, *args) + #def itembind_append(tag, context, cmd=Proc.new, *args) + # _bind_append([path, "bind", tagid(tag)], context, cmd, *args) + # self + #end + def itembind_append(tag, context, *args) + if args[0].kind_of?(Proc) || args[0].kind_of?(Method) + cmd = args.shift + else + cmd = Proc.new + end _bind_append([path, "bind", tagid(tag)], context, cmd, *args) self end |