lib/ffi-tk/command/bind.rb in ffi-tk-2009.12.14 vs lib/ffi-tk/command/bind.rb in ffi-tk-2010.01

- old
+ new

@@ -1,11 +1,28 @@ module Tk module Bind - def self.bind(pathname, sequence, &block) - Event::Handler.register(pathname, sequence, &block) + def self.bind(tag, sequence = None) + if None == sequence + Tk.execute(:bind, tag).to_a + else + if block_given? + Event::Handler.register(tag, sequence, &Proc.new) + else + Tk.execute(:bind, tag, sequence).to_s + end + end end - def bind(sequence, &block) + # TODO: remove the block associated + def self.unbind(tag, sequence) + Event::Handler.unregister(tag, sequence) + end + + def bind(sequence = None, &block) Bind.bind(tk_pathname, sequence, &block) end + + def unbind(sequence) + Bind.unbind(tk_pathname, sequence) + end end -end \ No newline at end of file +end