Extended maintenance of Ruby 1.9.3 ended on February 23, 2015. Read more
def initialize(parent, type=None)
widgetname = nil if parent.kind_of? Hash keys = _symbolkey2str(parent) parent = keys.delete('parent') widgetname = keys.delete('widgetname') type = keys.delete('type'); type = None unless type end #unless parent.kind_of?(TkMenu) # fail ArgumentError, "parent must be TkMenu" #end @parent = parent install_win(@parent.path, widgetname) tk_call_without_enc(@parent.path, 'clone', @path, type)
end
# File tk/lib/tk/menu.rb, line 435
def initialize(src_menu, *args)
widgetname = nil
if args[0].kind_of?(TkWindow) # parent window
parent = args.shift
else
parent = src_menu
end
if args[0].kind_of?(String) || args[0].kind_of?(Symbol) # menu type
type = args.shift
else
type = None # 'normal'
end
if args[0].kind_of?(Hash)
keys = _symbolkey2str(args.shift)
parent = keys.delete('parent') if keys.has_key?('parent')
widgetname = keys.delete('widgetname')
type = keys.delete('type') if keys.has_key?('type')
else
keys = nil
end
@src_menu = src_menu
@parent = parent
@type = type
install_win(@parent.path, widgetname)
tk_call_without_enc(@src_menu.path, 'clone', @path, @type)
configure(keys) if keys && !keys.empty?
end
Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.
If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.
If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.
If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.