Module: Tk::After

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

Class Method Summary collapse

Class Method Details

.idleObject



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

def idle
  id = nil

  wrap = lambda do |*_args|
    yield
    Tk.unregister_proc(id)
    true
  end

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

.ms(ms) ⇒ Object



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

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

    wrap = lambda do |*_args|
      block.call
      Tk.unregister_proc(id)
      true
    end

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