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

Methods

Included Modules

TkListItemConfig Scrollable

Constants

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

Public Instance methods

[Source]

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

[Source]

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

[Source]

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

Alias for clear

[Source]

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

[Source]

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

[Source]

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

[Source]

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

[Source]

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

[Source]

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

[Source]

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

[Source]

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

def create_self(keys)

  if keys and keys != None
    tk_call_without_enc('listbox', @path, *hash_kv(keys, true))
  else
    tk_call_without_enc('listbox', @path)
  end

end private :create_self

[Source]

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

    _get_eval_string(id)
  end

[Source]

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

[Source]

# File tk/lib/tk/listbox.rb, line 84
  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]