In Files

  • tk/lib/tk/menu.rb

Parent

Class/Module Index [+]

Quicksearch

Tk::MenuClone

Public Class Methods

new(src_menu, *args) click to toggle source

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 436
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
            

Public Instance Methods

source_menu() click to toggle source
 
               # File tk/lib/tk/menu.rb, line 468
def source_menu
  @src_menu
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.