Class | Tk::TkTable
In: | tk/lib/tkextlib/tktable/tktable.rb
Parent: | TkWindow

### Methods

__destroy_hook__ __validation_class_list activate bbox border_dragto border_mark border_mark_col border_mark_row clear_all clear_cache clear_sizes clear_tags col_index curselection curselection= curvalue curvalue= delete_active delete_cols delete_rows get get_area height height_list hidden? hidden_list icursor icursor_set index insert_active insert_cols insert_rows package_name package_version reread row_index scan_dragto scan_mark see selection_anchor selection_clear selection_clear_all selection_include? selection_present selection_set set set_col set_height set_row set_spans set_width span span_list spans tag_cell tag_col tag_col_reset tag_delete tag_exist? tag_include? tag_lower tag_names tag_raise tag_reset tag_row tag_row_reset tagid tagid2obj validate width width_list window_delete window_move window_names

### Included Modules

Scrollable Tk::TkTable::ConfigMethod Tk::ValidateConfigure

### Classes and Modules

Module Tk::TkTable::ConfigMethod
Class Tk::TkTable::BrowseCommand
Class Tk::TkTable::CellCommand
Class Tk::TkTable::CellTag
Class Tk::TkTable::NamedCellTag
Class Tk::TkTable::SelectionCommand
Class Tk::TkTable::ValidateCommand

### Constants

PACKAGE_NAME | = | 'Tktable'.freeze
TkCommandNames | = | ['table'.freeze].freeze
WidgetClassName | = | 'Table'.freeze

### Public Class methods

package_name()

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 21
        def self.package_name
          PACKAGE_NAME
        end

package_version()

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 25
        def self.package_version
          begin
            TkPackage.require('Tktable')
          rescue
            ''
          end
        end

### Public Instance methods

__destroy_hook__()

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 222
      def __destroy_hook__
        Tk::TkTable::CelTag::CellTagID_TBL.delete(@path)
      end

__validation_class_list()

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 369
      def __validation_class_list
        super() <<
          BrowseCommand << CellCommand << SelectionCommand << ValidateCommand
      end

activate(idx)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 381
      def activate(idx)
        tk_send('activate', tagid(idx))
      end

bbox(idx)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 385
      def bbox(idx)
        list(tk_send('bbox', tagid(idx)))
      end

border_dragto(x, y)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 398
      def border_dragto(x, y)
        tk_send('border', 'dragto', x, y)
      end

border_mark(x, y)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 389
      def border_mark(x, y)
        simplelist(tk_send('border', 'mark', x, y))
      end

border_mark_col(x, y)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 395
      def border_mark_col(x, y)
        tk_send('border', 'mark', x, y, 'col')
      end

border_mark_row(x, y)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 392
      def border_mark_row(x, y)
        tk_send('border', 'mark', x, y, 'row')
      end

clear_all(first=None, last=None)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 414
      def clear_all(first=None, last=None)
        tk_send('clear', 'all', tagid(first), tagid(last))
        self
      end

clear_cache(first=None, last=None)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 402
      def clear_cache(first=None, last=None)
        tk_send('clear', 'cache', tagid(first), tagid(last))
        self
      end

clear_sizes(first=None, last=None)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 406
      def clear_sizes(first=None, last=None)
        tk_send('clear', 'sizes', tagid(first), tagid(last))
        self
      end

clear_tags(first=None, last=None)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 410
      def clear_tags(first=None, last=None)
        tk_send('clear', 'tags', tagid(first), tagid(last))
        self
      end

col_index(idx)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 512
      def col_index(idx)
        number(tk_send('index', tagid(idx), 'col'))
      end

curselection()

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 419
      def curselection
        simplelist(tk_send('curselection'))
      end

curselection=(val)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 422
      def curselection=(val)
        tk_send('curselection', val)
        val
      end

curvalue()

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 427
      def curvalue
        tk_tcl2ruby(tk_send('curvalue'), true, false)
      end

curvalue=(val)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 430
      def curvalue=(val)
        tk_send('curvalue', val)
        val
      end

delete_active(idx1, idx2=None)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 435
      def delete_active(idx1, idx2=None)
        tk_send('delete', 'active', tagid(idx1), tagid(idx2))
        self
      end

delete_cols(*args)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 439
      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

delete_rows(*args)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 451
      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

get(idx)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 464
      def get(idx)
        tk_tcl2ruby(tk_send('get', tagid(idx)), true, false)
      end

get_area(idx1, idx2)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 467
      def get_area(idx1, idx2)
        simplelist(tk_send('get', tagid(idx1), tagid(idx2))).collect{|v|
          tk_tcl2ruby(v, true, false)
        }
      end

height(row)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 476
      def height(row)
        number(tk_send('height', row))
      end

height_list()

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 473
      def height_list
        list(tk_send('height'))
      end

hidden?(idx, *args)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 487
      def hidden?(idx, *args)
        if args.empty?
          if (ret = tk_send('hidden', tagid(idx))) == ''
            false
          else
            ret
          end
        else
          bool(tk_send('hidden', tagid(idx), *(args.collect{|i| tagid(i)})))
        end
      end

hidden_list()

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 484
      def hidden_list
        simplelist(tk_send('hidden'))
      end

icursor()

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 499
      def icursor
        number(tk_send('icursor'))
      end

icursor_set(idx)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 502
      def icursor_set(idx)
        number(tk_send('icursor', tagid(idx)))
      end

index(idx)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 506
      def index(idx)
        tk_send('index', tagid(idx))
      end

insert_active(idx, val)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 516
      def insert_active(idx, val)
        tk_send('insert', 'active', tagid(idx), val)
        self
      end

insert_cols(*args)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 520
      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

insert_rows(*args)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 532
      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

reread()

def postscript(*args)

      tk_send('postscript', *args)

end

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 549
      def reread
        tk_send('reread')
        self
      end

row_index(idx)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 509
      def row_index(idx)
        number(tk_send('index', tagid(idx), 'row'))
      end

scan_dragto(x, y)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 558
      def scan_dragto(x, y)
        tk_send('scan', 'dragto', x, y)
        self
      end

scan_mark(x, y)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 554
      def scan_mark(x, y)
        tk_send('scan', 'mark', x, y)
        self
      end

see(idx)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 563
      def see(idx)
        tk_send('see', tagid(idx))
        self
      end

selection_anchor(idx)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 568
      def selection_anchor(idx)
        tk_send('selection', 'anchor', tagid(idx))
        self
      end

selection_clear(first, last=None)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 572
      def selection_clear(first, last=None)
        tk_send('selection', 'clear', tagid(first), tagid(last))
        self
      end

selection_clear_all()

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 576
      def selection_clear_all
        selection_clear('all')
      end

selection_include?(idx)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 579
      def selection_include?(idx)
        bool(tk_send('selection', 'includes', tagid(idx)))
      end

selection_present()

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 582
      def selection_present
        bool(tk_send('selection', 'present'))
      end

selection_set(first, last=None)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 585
      def selection_set(first, last=None)
        tk_send('selection', 'set', tagid(first), tagid(last))
        self
      end

set(*pairs)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 590
      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

set_col(*pairs)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 608
      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

set_height(*pairs)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 479
      def set_height(*pairs)
        tk_send('height', *(pairs.flatten))
        self
      end

set_row(*pairs)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 599
      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

set_spans(*pairs)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 686
      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

set_width(*pairs)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 823
      def set_width(*pairs)
        tk_send('width', *(pairs.flatten))
        self
      end

span(idx)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 680
      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

span_list()

Alias for spans

spans()

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 671
      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

tag_cell(tag, *cells)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 760
      def tag_cell(tag, *cells)
        tk_send('tag', 'cell', tagid(tag), *(cells.collect{|idx| tagid(idx)}))
        self
      end

tag_col(tag, *cols)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 768
      def tag_col(tag, *cols)
        tk_send('tag', 'col', tagid(tag), *cols)
        self
      end

tag_col_reset(*cols)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 772
      def tag_col_reset(*cols)
        tk_send('tag', 'col', '', *cols)
        self
      end

tag_delete(tag)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 776
      def tag_delete(tag)
        tk_send('tag', 'delete', tagid(tag))
        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

tag_exist?(tag)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 787
      def tag_exist?(tag)
        bool(tk_send('tag', 'exists', tagid(tag)))
      end

tag_include?(tag, idx)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 790
      def tag_include?(tag, idx)
        bool(tk_send('tag', 'includes', tagid(tag), tagid(idx)))
      end

tag_lower(tag, target=None)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 793
      def tag_lower(tag, target=None)
        tk_send('tag', 'lower', tagid(tag), tagid(target))
        self
      end

tag_names(pat=None)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 797
      def tag_names(pat=None)
        simplelist(tk_send('tag', 'names', pat)).collect{|tag| tagid2obj(tag)}
      end

tag_raise(tag, target=None)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 800
      def tag_raise(tag, target=None)
        tk_send('tag', 'raise', tagid(tag), tagid(target))
        self
      end

tag_reset(*cells)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 764
      def tag_reset(*cells)
        tk_send('tag', 'cell', '', *(cells.collect{|idx| tagid(idx)}))
        self
      end

tag_row(tag, *rows)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 804
      def tag_row(tag, *rows)
        tk_send('tag', 'row', tagid(tag), *rows)
        self
      end

tag_row_reset(*rows)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 808
      def tag_row_reset(*rows)
        tk_send('tag', 'row', '', *rows)
        self
      end

tagid(tag)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 733
      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

tagid2obj(tagid)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 748
      def tagid2obj(tagid)
        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

validate(idx)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 813
      def validate(idx)
        bool(tk_send('validate', tagid(idx)))
      end

width(row)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 820
      def width(row)
        number(tk_send('width', row))
      end

width_list()

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 817
      def width_list
        list(tk_send('width'))
      end

window_delete(*args)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 828
      def window_delete(*args)
        tk_send('window', 'delete', *(args.collect{|idx| tagid(idx)}))
        self
      end

window_move(from_idx, to_idx)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 832
      def window_move(from_idx, to_idx)
        tk_send('window', 'move', tagid(from_idx), tagid(to_idx))
        self
      end

window_names(pat=None)

[Source]

    # File tk/lib/tkextlib/tktable/tktable.rb, line 836
      def window_names(pat=None)
        simplelist(tk_send('window', 'names', pat))
      end

[Validate]