Class: TkListbox

Class | TkListbox
In: | tk/lib/tk/listbox.rb
Parent: | TkTextWin

### Methods

activate clear curselection erase get index nearest selection_anchor selection_clear selection_includes selection_set size tagid value value=

### Included Modules

TkListItemConfig Scrollable

### Constants

TkCommandNames | = | ['listbox'.freeze].freeze
WidgetClassName | = | 'Listbox'.freeze

### Public Instance methods

activate(y)

[Source]

    # File tk/lib/tk/listbox.rb, line 45
      def activate(y)
        tk_send_without_enc('activate', y)
        self
      end

clear()

[Source]

    # File tk/lib/tk/listbox.rb, line 100
      def clear
        tk_send_without_enc('delete', '0', 'end')
        self
      end

curselection()

[Source]

    # File tk/lib/tk/listbox.rb, line 49
      def curselection
        list(tk_send_without_enc('curselection'))
      end

erase()

Alias for clear

get(first, last=nil)

[Source]

    # File tk/lib/tk/listbox.rb, line 52
      def get(first, last=nil)
        if last
          # tk_split_simplelist(_fromUTF8(tk_send_without_enc('get', first, last)))
          tk_split_simplelist(tk_send_without_enc('get', first, last), false, true)
        else
          _fromUTF8(tk_send_without_enc('get', first))
        end
      end

index(idx)

[Source]

    # File tk/lib/tk/listbox.rb, line 82
      def index(idx)
        tk_send_without_enc('index', idx).to_i
      end

nearest(y)

[Source]

    # File tk/lib/tk/listbox.rb, line 60
      def nearest(y)
        tk_send_without_enc('nearest', y).to_i
      end

selection_anchor(index)

[Source]

    # File tk/lib/tk/listbox.rb, line 66
      def selection_anchor(index)
        tk_send_without_enc('selection', 'anchor', index)
        self
      end

selection_clear(first, last=None)

[Source]

    # File tk/lib/tk/listbox.rb, line 70
      def selection_clear(first, last=None)
        tk_send_without_enc('selection', 'clear', first, last)
        self
      end

selection_includes(index)

[Source]

    # File tk/lib/tk/listbox.rb, line 74
      def selection_includes(index)
        bool(tk_send_without_enc('selection', 'includes', index))
      end

selection_set(first, last=None)

[Source]

    # File tk/lib/tk/listbox.rb, line 77
      def selection_set(first, last=None)
        tk_send_without_enc('selection', 'set', first, last)
        self
      end

size()

[Source]

    # File tk/lib/tk/listbox.rb, line 63
      def size
        tk_send_without_enc('size').to_i
      end

tagid(id)

[Source]

    # File tk/lib/tk/listbox.rb, line 40
      def tagid(id)
        #id.to_s
        _get_eval_string(id)
      end

value()

[Source]

    # File tk/lib/tk/listbox.rb, line 86
      def value
        get('0', 'end')
      end

value=(vals)

[Source]

    # File tk/lib/tk/listbox.rb, line 90
      def value= (vals)
        unless vals.kind_of?(Array)
          fail ArgumentError, 'an Array is expected'
        end
        tk_send_without_enc('delete', '0', 'end')
        tk_send_without_enc('insert', '0',
                            *(vals.collect{|v| _get_eval_enc_str(v)}))
        vals
      end

[Validate]