class Tk::Button

A button is a widget that displays a textual string, bitmap or image. If text is displayed, it must all be in a single font, but it can occupy multiple lines on the screen (if it contains newlines or if wrapping occurs because of the wrapLength option) and one of the characters may optionally be underlined using the underline option. It can display itself in either of three different ways, according to the state option; it can be made to appear raised, sunken, or flat; and it can be made to flash. When a user invokes the button (by pressing mouse button 1 with the cursor over the button), then the command specified in the -command option is invoked.

Public Class Methods

new(parent = Tk.root, options = None, &block) click to toggle source

TODO: implement custom procs

Calls superclass method Tk::Widget::new
# File lib/ffi-tk/widget/button.rb, line 22
def initialize(parent = Tk.root, options = None, &block)
  if block
    options = {} unless options.respond_to?(:[]=)
    options[:command] = register_command(:command, &block)
  end

  super
end
tk_command() click to toggle source
# File lib/ffi-tk/widget/button.rb, line 17
def self.tk_command
  'button'
end

Public Instance Methods

destroy() click to toggle source
Calls superclass method
# File lib/ffi-tk/widget/button.rb, line 31
def destroy
  unregister_commands
  super
end
flash() click to toggle source
# File lib/ffi-tk/widget/button.rb, line 40
def flash
  execute_only('flash')
end
invoke() click to toggle source
# File lib/ffi-tk/widget/button.rb, line 36
def invoke
  execute_only('invoke')
end