# File tk/lib/tkextlib/tktable/tktable.rb, line 272
def __destroy_hook__
Tk::TkTable::CelTag::CellTagID_TBL.mutex.synchronize{
Tk::TkTable::CelTag::CellTagID_TBL.delete(@path)
}
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 493
def __validation_class_list
super() <<
BrowseCommand << CellCommand << SelectionCommand << ValidateCommand
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 505
def activate(idx)
tk_send('activate', tagid(idx))
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 509
def bbox(idx)
list(tk_send('bbox', tagid(idx)))
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 522
def border_dragto(x, y)
tk_send('border', 'dragto', x, y)
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 513
def border_mark(x, y)
simplelist(tk_send('border', 'mark', x, y))
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 519
def border_mark_col(x, y)
tk_send('border', 'mark', x, y, 'col')
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 516
def border_mark_row(x, y)
tk_send('border', 'mark', x, y, 'row')
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 538
def clear_all(first=None, last=None)
tk_send('clear', 'all', tagid(first), tagid(last))
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 526
def clear_cache(first=None, last=None)
tk_send('clear', 'cache', tagid(first), tagid(last))
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 530
def clear_sizes(first=None, last=None)
tk_send('clear', 'sizes', tagid(first), tagid(last))
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 636
def col_index(idx)
number(tk_send('index', tagid(idx), 'col'))
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 543
def curselection
simplelist(tk_send('curselection'))
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 546
def curselection=(val)
tk_send('curselection', val)
val
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 551
def curvalue
tk_tcl2ruby(tk_send('curvalue'), true, false)
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 554
def curvalue=(val)
tk_send('curvalue', val)
val
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 559
def delete_active(idx1, idx2=None)
tk_send('delete', 'active', tagid(idx1), tagid(idx2))
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 563
def delete_cols(*args) # ?switches_array?, index, ?count?
params = []
if args[0].kind_of?(Array)
switches = args.shift
switches.each{|k| params << "-#{k}"}
end
params << '--'
params << tagid(args.shift)
params.concat(args)
tk_send('delete', 'cols', *params)
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 575
def delete_rows(*args) # ?switches_array?, index, ?count?
params = []
if args[0].kind_of?(Array)
switches = args.shift
switches.each{|k| params << "-#{k}"}
end
params << '--'
params << tagid(args.shift)
params.concat(args)
tk_send('delete', 'rows', *params)
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 588
def get(idx)
tk_tcl2ruby(tk_send('get', tagid(idx)), true, false)
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 591
def get_area(idx1, idx2)
simplelist(tk_send('get', tagid(idx1), tagid(idx2))).collect{|v|
tk_tcl2ruby(v, true, false)
}
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 600
def height(row)
number(tk_send('height', row))
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 597
def height_list
list(tk_send('height'))
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 623
def icursor
number(tk_send('icursor'))
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 626
def icursor_set(idx)
number(tk_send('icursor', tagid(idx)))
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 630
def index(idx)
tk_send('index', tagid(idx))
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 640
def insert_active(idx, val)
tk_send('insert', 'active', tagid(idx), val)
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 644
def insert_cols(*args) # ?switches_array?, index, ?count?
params = []
if args[0].kind_of?(Array)
switches = args.shift
switches.each{|k| params << "-#{k}"}
end
params << '--'
params.concat(args)
params << tagid(args.shift)
tk_send('insert', 'cols', *params)
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 656
def insert_rows(*args) # ?switches_array?, index, ?count?
params = []
if args[0].kind_of?(Array)
switches = args.shift
switches.each{|k| params << "-#{k}"}
end
params << '--'
params << tagid(args.shift)
params.concat(args)
tk_send('insert', 'rows', *params)
self
end
def postscript(*args)
tk_send('postscript', *args)
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 673
def reread
tk_send('reread')
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 633
def row_index(idx)
number(tk_send('index', tagid(idx), 'row'))
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 682
def scan_dragto(x, y)
tk_send('scan', 'dragto', x, y)
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 678
def scan_mark(x, y)
tk_send('scan', 'mark', x, y)
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 687
def see(idx)
tk_send('see', tagid(idx))
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 692
def selection_anchor(idx)
tk_send('selection', 'anchor', tagid(idx))
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 696
def selection_clear(first, last=None)
tk_send('selection', 'clear', tagid(first), tagid(last))
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 700
def selection_clear_all
selection_clear('all')
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 703
def selection_include?(idx)
bool(tk_send('selection', 'includes', tagid(idx)))
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 706
def selection_present
bool(tk_send('selection', 'present'))
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 709
def selection_set(first, last=None)
tk_send('selection', 'set', tagid(first), tagid(last))
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 714
def set(*pairs) # idx, val, idx, val, ...
args = []
0.step(pairs.size-1, 2){|i|
args << tagid(pairs[i])
args << pairs[i+1]
}
tk_send('set', *args)
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 732
def set_col(*pairs) # idx, val, idx, val, ...
args = []
0.step(pairs.size-1, 2){|i|
args << tagid(pairs[i])
args << pairs[i+1]
}
tk_send('set', 'col', *args)
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 603
def set_height(*pairs)
tk_send('height', *(pairs.flatten))
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 723
def set_row(*pairs) # idx, val, idx, val, ...
args = []
0.step(pairs.size-1, 2){|i|
args << tagid(pairs[i])
args << pairs[i+1]
}
tk_send('set', 'row', *args)
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 810
def set_spans(*pairs)
# idx, val, idx, val, ...
args = []
0.step(pairs.size-1, 2){|i|
args << tagid(pairs[i])
val = pairs[i+1]
if val.kind_of?(Array)
args << val.join(',')
else
args << val
end
}
tk_send('spans', *args)
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 951
def set_width(*pairs)
tk_send('width', *(pairs.flatten))
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 804
def span(idx)
lst = simplelist(tk_send('spans', tagid(idx)))
idx = lst[0]
rows, cols = lst[1].split(',').map!{|n| Integer(n)}
[idx [rows, cols]]
end
def set(*pairs) # idx, val, idx, val, … OR [idx, val], [idx, val], …
if pairs[0].kind_of?(Array) # [idx, val], [idx, val], ... args = [] pairs.each{|idx, val| args << tagid(idx) << val } tk_send('set', *args) else # idx, val, idx, val, ... args = [] 0.step(pairs.size-1, 2){|i| args << tagid(pairs[i]) args << pairs[i+1] } tk_send('set', *args) end self
end def #set_row(*pairs)
if pairs[0].kind_of?(Array) # [idx, val], [idx, val], ... args = [] pairs.each{|idx, val| args << tagid(idx) << val } tk_send('set', 'row', *args) else # idx, val, idx, val, ... args = [] 0.step(pairs.size-1, 2){|i| args << tagid(pairs[i]) args << pairs[i+1] } tk_send('set', 'row', *args) end self
end def #set_col(*pairs)
if pairs[0].kind_of?(Array) # [idx, val], [idx, val], ... args = [] pairs.each{|idx, val| args << idx << val } tk_send('set', 'col', *args) else # idx, val, idx, val, ... args = [] 0.step(pairs.size-1, 2){|i| args << tagid(pairs[i]) args << pairs[i+1] } tk_send('set', 'col', *args) end self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 795
def spans
simplelist(tk_send('spans')).collect{|inf|
lst = simplelist(inf)
idx = lst[0]
rows, cols = lst[1].split(',').map!{|n| Integer(n)}
[idx [rows, cols]]
}
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 886
def tag_cell(tag, *cells)
tk_send('tag', 'cell', tagid(tag), *(cells.collect{|idx| tagid(idx)}))
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 894
def tag_col(tag, *cols)
tk_send('tag', 'col', tagid(tag), *cols)
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 898
def tag_col_reset(*cols)
tk_send('tag', 'col', '', *cols)
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 902
def tag_delete(tag)
tk_send('tag', 'delete', tagid(tag))
Tk::TkTable::CellTag::CellTagID_TBL.mutex.synchronize{
if Tk::TkTable::CellTag::CellTagID_TBL[@path]
if tag.kind_of? Tk::TkTable::CellTag
Tk::TkTable::CellTag::CellTagID_TBL[@path].delete(tag.id)
else
Tk::TkTable::CellTag::CellTagID_TBL[@path].delete(tag)
end
end
}
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 915
def tag_exist?(tag)
bool(tk_send('tag', 'exists', tagid(tag)))
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 918
def tag_include?(tag, idx)
bool(tk_send('tag', 'includes', tagid(tag), tagid(idx)))
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 921
def tag_lower(tag, target=None)
tk_send('tag', 'lower', tagid(tag), tagid(target))
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 925
def tag_names(pat=None)
simplelist(tk_send('tag', 'names', pat)).collect{|tag| tagid2obj(tag)}
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 928
def tag_raise(tag, target=None)
tk_send('tag', 'raise', tagid(tag), tagid(target))
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 890
def tag_reset(*cells)
tk_send('tag', 'cell', '', *(cells.collect{|idx| tagid(idx)}))
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 932
def tag_row(tag, *rows)
tk_send('tag', 'row', tagid(tag), *rows)
self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 936
def tag_row_reset(*rows)
tk_send('tag', 'row', '', *rows)
self
end
def #set_spans(*pairs)
if pairs[0].kind_of?(Array) # [idx, val], [idx, val], ... args = [] pairs.each{|idx, val| args << tagid(idx) if val.kind_of?(Array) args << val.join(',') else args << val end } tk_send('spans', *args) else # idx, val, idx, val, ... args = [] 0.step(pairs.size-1, 2){|i| args << tagid(pairs[i]) val = pairs[i+1] if val.kind_of?(Array) args << val.join(',') else args << val end } tk_send('spans', *args) end self
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 857
def tagid(tag)
if tag.kind_of?(Tk::TkTable::CellTag)
tag.id
elsif tag.kind_of?(Array)
if tag[0].kind_of?(Integer) && tag[1].kind_of?(Integer)
# [row, col]
tag.join(',')
else
tag
end
else
tag
end
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 872
def tagid2obj(tagid)
Tk::TkTable::CellTag::CellTagID_TBL.mutex.synchronize{
if Tk::TkTable::CellTag::CellTagID_TBL.key?(@path)
if Tk::TkTable::CellTag::CellTagID_TBL[@path].key?(tagid)
Tk::TkTable::CellTag::CellTagID_TBL[@path][tagid]
else
tagid
end
else
tagid
end
}
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 941
def validate(idx)
bool(tk_send('validate', tagid(idx)))
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 948
def width(row)
number(tk_send('width', row))
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 945
def width_list
list(tk_send('width'))
end
# File tk/lib/tkextlib/tktable/tktable.rb, line 956
def window_delete(*args)
tk_send('window', 'delete', *(args.collect{|idx| tagid(idx)}))
self
end
Commenting is here to help enhance the documentation. For example, code samples, 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.
If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.