Method: Tk::TkTable#tagid

Defined in:
lib/tkextlib/tktable/tktable.rb

#tagid(tag) ⇒ Object

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


857
858
859
860
861
862
863
864
865
866
867
868
869
870
# File '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