Cells and tables

Jo=?ISO-8859-1?B?6w==?=l Guillod joel.guillod at net2000.ch
Wed Oct 22 12:36:34 EDT 2003


Why not simply define the following script in the table field:

getProp cell[where]
  put item 1 of where into tRownum
  put item 2 of where into tColnum
  set the itemdel to tab
  return item tColnum of line tRownum of me
end cell

setprop cell[where] newValue
  put item 1 of where into tRownum
  put item 2 of where into tColnum
  set the itemdel to tab
  -- optionaly check here that newValue does not contain the itemdel:
  if the itemdel is in newValue
  then throw "Exception : new value should be 1 item!"
  put newValue into item tColnum of line tRownum of me
end cell


Then, you can set and get cell value with:

put the cell[3,4] of fld myTable into myCellValue

set the cell[2,2] of fld myTable to myNewValue

TIPS: you can change the "me" keyword to "the target" and put the script in
a generic library to work for any field, without having to duplicate the
script inside each script field! And it will also work for non table field.


Hope this help!


Joel Guillod



More information about the use-livecode mailing list