Cells and tables

Jan Schenkel janschenkel at yahoo.com
Wed Oct 22 07:59:51 EDT 2003


--- Malte Brill <malte.brill at t-online.de> wrote:
> Hey Jan,
> 
> exellent, as allways. :-)
> 
> Two small fixes:
> 

Actually, I saw some typos (oopsie) ; so lemmefix.

local sGeneratingCells

on rawkeyDown
  send generateCells to me in 10 ticks
  pass rawkeyDown
end rawkeyDown

on generateCells
  -- clear the previous content
  set the customProperties["uCell"] of me to empty
  ## had to be "uCell" instead of "cell" (JS)
  -- now fill the individual custom props
  set the itemDelimiter to tab
  put true into sGeneratingCells
  put 0 into tLineCounter
  repeat for each line tRow in me
    add 1 to tLineCounter
    put 0 into tItemCounter
    repeat for each item tColumn in tRow
      add 1 to lItemCounter
      set the uCell[tLineCounter,tItemCounter] \
          of me to tColumn
      ## looks a bit cleaner (JS)
    end repeat
  end repeat
  put false into sGeneratingCells
end generateCells

setProp uCell[pCoordinates] pNewContent
  if sGeneratingCells is not "true" then
    put item 1 of pCoordinates into tRow
    put item 2 of pCoordinates into tColumn
    set the itemDelimiter to tab
    ##itemDelimiter needs to be TAB here (MB)
    put pNewContent into item tColumn of \
        line tRow of me
  end if
  pass uCell
end uCell

--

And yes indeed, this allows :
  get the uCell[1,2] of fld "Foo"
  set the uCell[2,5] of fld "Foo" to "Bar"

Fun what you can do with a few lines of scripting,
isn't it ?

Best regards,

Jan Schenkel.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com


More information about the use-livecode mailing list