Module: Tk::Wait

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

Overview

Wait for variable to change or window to be destroyed

This module provides blocking calls that wait for one of several things to happen, then return without taking any other actions.

The tkwait command waits for one of several things to happen, then it returns without taking any other actions. The return value is always nil.

While the methods are waiting, events are processed in the normal fashion, so the application will continue to respond to user interactions. If an event handler invokes [Wait] methods again, the nested call must complete before the outer call can complete.

Class Method Summary collapse

Class Method Details

.variable(name) ⇒ Object

Waits for the variable called name to be modified.



19
20
21
# File 'lib/ffi-tk/command/wait.rb', line 19

def variable(name)
  Tk.execute_only(:tkwait, :variable, name)
end

.visibility(name) ⇒ Object

Takes the name of a window and waits for a change in its visibility state (as indicated by the arrival of a VisibilityNotify event). Typically used to wait for a newly-created window to appear on the screen before taking some action.



27
28
29
# File 'lib/ffi-tk/command/wait.rb', line 27

def visibility(name)
  Tk.execute_only(:tkwait, :visibility, name)
end

.window(name) ⇒ Object

This method takes the name of a window as argument and waits until the window is destroyed. It is typically used to wait for a user to finish interacting with a dialog box before using the result of that interaction.



35
36
37
# File 'lib/ffi-tk/command/wait.rb', line 35

def window(name)
  Tk.execute_only(:tkwait, :window, name)
end