Class: TkOptionMenubutton

Class | TkOptionMenubutton
In: | tk/lib/tk/menu.rb
Parent: | TkMenubutton

### Methods

activate add current_entryconfiginfo current_menuconfiginfo delete entrycget entryconfiginfo entryconfigure index insert invoke menu menucget menuconfiginfo menuconfigure new value value= yposition

### Classes and Modules

Class TkOptionMenubutton::OptionMenu

### Constants

TkCommandNames | = | ['tk_optionMenu'.freeze].freeze

### Public Class methods

new(*args)

[Source]

    # File tk/lib/tk/menu.rb, line 455
      def initialize(*args)
        # args :: [parent,] [var,] [value[, ...],] [keys]
        #    parent --> TkWindow or nil
        #    var    --> TkVariable or nil
        #    keys   --> Hash
        #       keys[:parent] or keys['parent']     --> parent
        #       keys[:variable] or keys['variable'] --> var
        #       keys[:values] or keys['values']     --> value, ...
        #       other Hash keys are menubutton options
        keys = {}
        keys = args.pop if args[-1].kind_of?(Hash)
        keys = _symbolkey2str(keys)

        parent = nil
        if args[0].kind_of?(TkWindow) || args[0] == nil
          keys.delete('parent') # ignore
          parent = args.shift
        else
          parent = keys.delete('parent')
        end

        @variable = nil
        if args[0].kind_of?(TkVariable) || args[0] == nil
          keys.delete('variable') # ignore
          @variable = args.shift
        else
          @variable = keys.delete('variable')
        end
        @variable = TkVariable.new unless @variable

        (args = keys.delete('values') || []) if args.empty?
        if args.empty?
          args << @variable.value
        else
          @variable.value = args[0]
        end

        install_win(if parent then parent.path end)
        @menu = OptionMenu.new(tk_call('tk_optionMenu',
                                       @path, @variable.id, *args))

        configure(keys) if keys
      end

### Public Instance methods

activate(index)

[Source]

    # File tk/lib/tk/menu.rb, line 507
      def activate(index)
        @menu.activate(index)
        self
      end

add(value)

[Source]

    # File tk/lib/tk/menu.rb, line 511
      def add(value)
        @menu.add('radiobutton', 'variable'=>@variable,
                  'label'=>value, 'value'=>value)
        self
      end

current_entryconfiginfo(index, key=nil)

[Source]

    # File tk/lib/tk/menu.rb, line 560
      def current_entryconfiginfo(index, key=nil)
        @menu.current_entryconfiginfo(index, key)
      end

current_menuconfiginfo(key=nil)

[Source]

    # File tk/lib/tk/menu.rb, line 547
      def current_menuconfiginfo(key=nil)
        @menu.current_configinfo(key)
      end

delete(index, last=None)

[Source]

    # File tk/lib/tk/menu.rb, line 527
      def delete(index, last=None)
        @menu.delete(index, last)
        self
      end

entrycget(index, key)

[Source]

    # File tk/lib/tk/menu.rb, line 550
      def entrycget(index, key)
        @menu.entrycget(index, key)
      end

entryconfiginfo(index, key=nil)

[Source]

    # File tk/lib/tk/menu.rb, line 557
      def entryconfiginfo(index, key=nil)
        @menu.entryconfiginfo(index, key)
      end

entryconfigure(index, key, val=None)

[Source]

    # File tk/lib/tk/menu.rb, line 553
      def entryconfigure(index, key, val=None)
        @menu.entryconfigure(index, key, val)
        self
      end

index(index)

[Source]

    # File tk/lib/tk/menu.rb, line 516
      def index(index)
        @menu.index(index)
      end

insert(index, value)

[Source]

    # File tk/lib/tk/menu.rb, line 522
      def insert(index, value)
        @menu.insert(index, 'radiobutton', 'variable'=>@variable,
                  'label'=>value, 'value'=>value)
        self
      end

invoke(index)

[Source]

    # File tk/lib/tk/menu.rb, line 519
      def invoke(index)
        @menu.invoke(index)
      end

menu()

[Source]

    # File tk/lib/tk/menu.rb, line 534
      def menu
        @menu
      end

menucget(key)

[Source]

    # File tk/lib/tk/menu.rb, line 537
      def menucget(key)
        @menu.cget(key)
      end

menuconfiginfo(key=nil)

[Source]

    # File tk/lib/tk/menu.rb, line 544
      def menuconfiginfo(key=nil)
        @menu.configinfo(key)
      end

menuconfigure(key, val=None)

[Source]

    # File tk/lib/tk/menu.rb, line 540
      def menuconfigure(key, val=None)
        @menu.configure(key, val)
        self
      end

value()

[Source]

    # File tk/lib/tk/menu.rb, line 499
      def value
        @variable.value
      end

value=(val)

[Source]

    # File tk/lib/tk/menu.rb, line 503
      def value=(val)
        @variable.value = val
      end

yposition(index)

[Source]

    # File tk/lib/tk/menu.rb, line 531
      def yposition(index)
        @menu.yposition(index)
      end

[Validate]