class Tk::CheckButton

Create and manipulate checkbutton widgets

Public Class Methods

new(parent = Tk.root, options = None) click to toggle source
Calls superclass method Tk::Button::new
# File lib/ffi-tk/widget/checkbutton.rb, line 11
def initialize(parent = Tk.root, options = None)
  if block_given?
    super do |options|
      options[:command] = register_command(:command, &Proc.new)
    end
  else
    super
  end
end
tk_command() click to toggle source
# File lib/ffi-tk/widget/checkbutton.rb, line 7
def self.tk_command
  'checkbutton'
end

Public Instance Methods

deselect() click to toggle source

Deselects the checkbutton and sets the associated variable to its “off” value.

# File lib/ffi-tk/widget/checkbutton.rb, line 23
def deselect
  execute_only(:deselect)
end
flash() click to toggle source

Flashes the checkbutton. This is accomplished by redisplaying the checkbutton several times, alternating between active and normal colors. At the end of the flash the checkbutton is left in the same normal/active state as when the command was invoked. This command is ignored if the checkbutton's state is disabled.

# File lib/ffi-tk/widget/checkbutton.rb, line 33
def flash
  execute_only(:flash)
end
invoke() click to toggle source

Does just what would have happened if the user invoked the checkbutton with the mouse: toggle the selection state of the button and invoke the Tcl command associated with the checkbutton, if there is one. The return value is the return value from the Tcl command, or an empty string if there is no command associated with the checkbutton. This command is ignored if the checkbutton's state is disabled.

# File lib/ffi-tk/widget/checkbutton.rb, line 43
def invoke
  execute_only(:invoke)
end
select() click to toggle source

Selects the checkbutton and sets the associated variable to its “on” value.

# File lib/ffi-tk/widget/checkbutton.rb, line 49
def select
  execute_only(:select)
end
toggle() click to toggle source

Toggles the selection state of the button, redisplaying it and modifying its associated variable to reflect the new state. pressed over a checkbutton, the button activates whenever the mouse pointer is inside the button, and deactivates whenever the mouse pointer leaves the button. minus (-) deselects the button. labelframe .lbl -text “Steps:” checkbutton .c1 -text Lights -variable lights checkbutton .c2 -text Cameras -variable cameras checkbutton .c3 -text Action! -variable action pack .c1 .c2 .c3 -in .lbl pack .lbl

# File lib/ffi-tk/widget/checkbutton.rb, line 62
def toggle
  execute_only(:toggle)
end