Module: Tk::Bind

Included in:
Widget
Defined in:
lib/ffi-tk/command/bind.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.bind(tag, sequence = None) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/ffi-tk/command/bind.rb', line 4

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

.unbind(tag, sequence) ⇒ Object

TODO: remove the block associated



17
18
19
# File 'lib/ffi-tk/command/bind.rb', line 17

def self.unbind(tag, sequence)
  Event::Handler.unregister(tag, sequence)
end

Instance Method Details

#bind(sequence = None, &block) ⇒ Object



21
22
23
# File 'lib/ffi-tk/command/bind.rb', line 21

def bind(sequence = None, &block)
  Bind.bind(tk_pathname, sequence, &block)
end

#unbind(sequence) ⇒ Object



25
26
27
# File 'lib/ffi-tk/command/bind.rb', line 25

def unbind(sequence)
  Bind.unbind(tk_pathname, sequence)
end