Extended maintenance of Ruby versions 1.8.7 and 1.9.2 ended on July 31, 2014. Read more
# File tk/lib/tk/menu.rb, line 97
def activate(index)
tk_send_without_enc('activate', _get_eval_enc_str(index))
self
end
# File tk/lib/tk/menu.rb, line 101
def add(type, keys=nil)
tk_send_without_enc('add', type, *hash_kv(keys, true))
self
end
# File tk/lib/tk/menu.rb, line 105
def add_cascade(keys=nil)
add('cascade', keys)
end
# File tk/lib/tk/menu.rb, line 111
def add_command(keys=nil)
add('command', keys)
end
# File tk/lib/tk/menu.rb, line 117
def add_separator(keys=nil)
add('separator', keys)
end
# File tk/lib/tk/menu.rb, line 162
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
# File tk/lib/tk/menu.rb, line 150
def index(idx)
ret = tk_send_without_enc('index', _get_eval_enc_str(idx))
(ret == 'none')? nil: number(ret)
end
# File tk/lib/tk/menu.rb, line 157
def insert(index, type, keys=nil)
tk_send_without_enc('insert', _get_eval_enc_str(index),
type, *hash_kv(keys, true))
self
end
# File tk/lib/tk/menu.rb, line 154
def invoke(index)
_fromUTF8(tk_send_without_enc('invoke', _get_eval_enc_str(index)))
end
# File tk/lib/tk/menu.rb, line 171
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
# File tk/lib/tk/menu.rb, line 180
def post(x, y)
_fromUTF8(tk_send_without_enc('post', x, y))
end
# File tk/lib/tk/menu.rb, line 183
def postcascade(index)
tk_send_without_enc('postcascade', _get_eval_enc_str(index))
self
end
# File tk/lib/tk/menu.rb, line 187
def postcommand(cmd=Proc.new)
configure_cmd 'postcommand', cmd
self
end
# File tk/lib/tk/menu.rb, line 191
def set_focus
tk_call_without_enc('tk_menuSetFocus', path)
self
end
# File tk/lib/tk/menu.rb, line 92
def tagid(id)
#id.to_s
_get_eval_string(id)
end
# File tk/lib/tk/menu.rb, line 195
def tearoffcommand(cmd=Proc.new)
configure_cmd 'tearoffcommand', cmd
self
end
# File tk/lib/tk/menu.rb, line 202
def unpost
tk_send_without_enc('unpost')
self
end