is NOT a subclass of a listbox widget class. because it constructed on a canvas widget.
# File tk/lib/tkextlib/bwidget/listbox.rb, line 225
def self.id2obj(lbox, id)
lpath = lbox.path
ListItem_TBL.mutex.synchronize{
if ListItem_TBL[lpath]
ListItem_TBL[lpath][id]? ListItem_TBL[lpath][id]: id
else
id
end
}
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 236
def initialize(lbox, *args)
if lbox.kind_of?(Tk::BWidget::ListBox)
@listbox = lbox
else
fail RuntimeError,
"expect Tk::BWidget::ListBox or Tk::BWidget::ListBox::Item for 1st argument"
end
if args[-1].kind_of?(Hash)
keys = _symbolkey2str(args.pop)
else
keys = {}
end
index = keys.delete('index')
unless args.empty?
index = args.shift
end
index = 'end' unless index
unless args.empty?
fail RuntimeError, 'too much arguments'
end
@lpath = @listbox.path
if keys.key?('itemname')
@path = @id = keys.delete('itemname')
else
ListItem_ID.mutex.synchronize{
@path = @id = ListItem_ID.join(TkCore::INTERP._ip_id_)
ListItem_ID[1].succ!
}
end
ListItem_TBL.mutex.synchronize{
ListItem_TBL[@id] = self
ListItem_TBL[@lpath] = {} unless ListItem_TBL[@lpath]
ListItem_TBL[@lpath][@id] = self
}
@listbox.insert(index, @id, keys)
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 288
def [](key)
cget(key)
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 292
def []=(key, val)
configure(key, val)
val
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 300
def cget(key)
@listbox.itemcget(@id, key)
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 303
def cget_strict(key)
@listbox.itemcget_strict(@id, key)
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 297
def cget_tkstring(key)
@listbox.itemcget_tkstring(@id, key)
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 311
def configinfo(key=nil)
@listbox.itemconfiginfo(@id, key)
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 307
def configure(key, val=None)
@listbox.itemconfigure(@id, key, val)
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 315
def current_configinfo(key=nil)
@listbox.current_itemconfiginfo(@id, key)
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 319
def delete
@listbox.delete(@id)
self
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 324
def edit(*args)
@listbox.edit(@id, *args)
self
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 329
def exist?
@listbox.exist?(@id)
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 333
def index
@listbox.index(@id)
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 280
def listbox
@listbox
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 337
def move(index)
@listbox.move(@id, index)
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 217
def mutex; @mutex; end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 341
def see
@listbox.see(@id)
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 345
def selection_add
@listbox.selection_add(@id)
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 349
def selection_remove
@listbox.selection_remove(@id)
end
Commenting is here to help enhance the documentation. For example, sample code, 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.