class Tk::Listbox

Constants

TkCommandNames
WidgetClassName

Public Instance Methods

activate(y) click to toggle source
# File lib/tk/listbox.rb, line 46
def activate(y)
  tk_send_without_enc('activate', y)
  self
end
clear() click to toggle source
# File lib/tk/listbox.rb, line 101
def clear
  tk_send_without_enc('delete', '0', 'end')
  self
end
Also aliased as: erase
curselection() click to toggle source
# File lib/tk/listbox.rb, line 50
def curselection
  list(tk_send_without_enc('curselection'))
end
erase()
Alias for: clear
get(first, last=nil) click to toggle source
# File lib/tk/listbox.rb, line 53
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) click to toggle source
# File lib/tk/listbox.rb, line 83
def index(idx)
  tk_send_without_enc('index', idx).to_i
end
nearest(y) click to toggle source
# File lib/tk/listbox.rb, line 61
def nearest(y)
  tk_send_without_enc('nearest', y).to_i
end
selection_anchor(index) click to toggle source
# File lib/tk/listbox.rb, line 67
def selection_anchor(index)
  tk_send_without_enc('selection', 'anchor', index)
  self
end
selection_clear(first, last=None) click to toggle source
# File lib/tk/listbox.rb, line 71
def selection_clear(first, last=None)
  tk_send_without_enc('selection', 'clear', first, last)
  self
end
selection_includes(index) click to toggle source
# File lib/tk/listbox.rb, line 75
def selection_includes(index)
  bool(tk_send_without_enc('selection', 'includes', index))
end
selection_set(first, last=None) click to toggle source
# File lib/tk/listbox.rb, line 78
def selection_set(first, last=None)
  tk_send_without_enc('selection', 'set', first, last)
  self
end
size() click to toggle source
# File lib/tk/listbox.rb, line 64
def size
  tk_send_without_enc('size').to_i
end
tagid(id) click to toggle source
# File lib/tk/listbox.rb, line 41
def tagid(id)
  #id.to_s
  _get_eval_string(id)
end
value() click to toggle source
# File lib/tk/listbox.rb, line 87
def value
  get('0', 'end')
end
value=(vals) click to toggle source
# File lib/tk/listbox.rb, line 91
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

Private Instance Methods

__tkvariable_optkeys() click to toggle source

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

Calls superclass method TkConfigMethod#__tkvariable_optkeys
# File lib/tk/listbox.rb, line 36
def __tkvariable_optkeys
  super() << 'listvariable'
end