Class TkMenu
In: tk/lib/tk/menu.rb
Parent: TkWindow

Methods

Included Modules

TkMenuEntryConfig

Constants

TkCommandNames = ['menu'.freeze].freeze
WidgetClassName = 'Menu'.freeze

Public Instance methods

[Source]

# File tk/lib/tk/menu.rb, line 55
  def activate(index)
    tk_send_without_enc('activate', _get_eval_enc_str(index))
    self
  end

[Source]

# File tk/lib/tk/menu.rb, line 59
  def add(type, keys=nil)
    tk_send_without_enc('add', type, *hash_kv(keys, true))
    self
  end

[Source]

# File tk/lib/tk/menu.rb, line 63
  def add_cascade(keys=nil)
    add('cascade', keys)
  end

[Source]

# File tk/lib/tk/menu.rb, line 66
  def add_checkbutton(keys=nil)
    add('checkbutton', keys)
  end

[Source]

# File tk/lib/tk/menu.rb, line 69
  def add_command(keys=nil)
    add('command', keys)
  end

[Source]

# File tk/lib/tk/menu.rb, line 72
  def add_radiobutton(keys=nil)
    add('radiobutton', keys)
  end

[Source]

# File tk/lib/tk/menu.rb, line 75
  def add_separator(keys=nil)
    add('separator', keys)
  end

[Source]

# File tk/lib/tk/menu.rb, line 90
  def delete(first, last=nil)
    if last
      tk_send_without_enc('delete', _get_eval_enc_str(first), 
                          _get_eval_enc_str(last))
    else
      tk_send_without_enc('delete', _get_eval_enc_str(first))
    end
    self
  end

[Source]

# File tk/lib/tk/menu.rb, line 78
  def index(index)
    ret = tk_send_without_enc('index', _get_eval_enc_str(index))
    (ret == 'none')? nil: number(ret)
  end

[Source]

# File tk/lib/tk/menu.rb, line 85
  def insert(index, type, keys=nil)
    tk_send_without_enc('insert', _get_eval_enc_str(index), 
                        type, *hash_kv(keys, true))
    self
  end

[Source]

# File tk/lib/tk/menu.rb, line 82
  def invoke(index)
    _fromUTF8(tk_send_without_enc('invoke', _get_eval_enc_str(index)))
  end

[Source]

# File tk/lib/tk/menu.rb, line 127
  def menutype(index)
    tk_send_without_enc('type', _get_eval_enc_str(index))
  end

[Source]

# File tk/lib/tk/menu.rb, line 99
  def popup(x, y, index=nil)
    if index
      tk_call_without_enc('tk_popup', path, x, y, 
                          _get_eval_enc_str(index))
    else
      tk_call_without_enc('tk_popup', path, x, y)
    end
    self
  end

[Source]

# File tk/lib/tk/menu.rb, line 108
  def post(x, y)
    _fromUTF8(tk_send_without_enc('post', x, y))
  end

[Source]

# File tk/lib/tk/menu.rb, line 111
  def postcascade(index)
    tk_send_without_enc('postcascade', _get_eval_enc_str(index))
    self
  end

[Source]

# File tk/lib/tk/menu.rb, line 115
  def postcommand(cmd=Proc.new)
    configure_cmd 'postcommand', cmd
    self
  end

[Source]

# File tk/lib/tk/menu.rb, line 119
  def set_focus
    tk_call_without_enc('tk_menuSetFocus', path)
    self
  end

def create_self(keys)

  if keys and keys != None
    tk_call_without_enc('menu', @path, *hash_kv(keys, true))
  else
    tk_call_without_enc('menu', @path)
  end

end private :create_self

[Source]

# File tk/lib/tk/menu.rb, line 50
  def tagid(id)
    #id.to_s

    _get_eval_string(id)
  end

[Source]

# File tk/lib/tk/menu.rb, line 123
  def tearoffcommand(cmd=Proc.new)
    configure_cmd 'tearoffcommand', cmd
    self
  end

[Source]

# File tk/lib/tk/menu.rb, line 130
  def unpost
    tk_send_without_enc('unpost')
    self
  end

[Source]

# File tk/lib/tk/menu.rb, line 134
  def yposition(index)
    number(tk_send_without_enc('yposition', _get_eval_enc_str(index)))
  end

[Validate]