Module: Tk::After

Defined in:
lib/ffi-tk/command/after.rb

Class Method Summary collapse

Class Method Details

.idle(&block) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/ffi-tk/command/after.rb', line 23

def idle(&block)
  id = nil

  wrap = lambda{|*args|
    block.call
    Tk.unregister_proc(id)
    true
  }

  id, command = Tk.register_proc(wrap, 'after_idle')
  Tk.execute_only(:after, :idle, command)
end

.ms(ms) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/ffi-tk/command/after.rb', line 5

def ms(ms)
  if block_given?
    id = nil
    block = Proc.new

    wrap = lambda{|*args|
      block.call
      Tk.unregister_proc(id)
      true
    }

    id, command = Tk.register_proc(wrap, 'after_ms')
    Tk.execute_only(:after, ms, command)
  else
    Tk.execute_only(:after, ms)
  end
end