Table'itis

Jan Schenkel janschenkel at yahoo.com
Fri Jul 11 00:43:00 EDT 2003


--- HyperChris at aol.com wrote:
> Try this ...
> 1. Create a new blank mainstack.
> 2. Draw a descent sized Field on it
> 3. Go into the Inspector and check the Table
> settings (Table Object and Cell 
> Edit)
> 4. Put some numbers in the first four cells of
> column one (how about 1, 2 ,3 
> and 4)
> 5. Open the message box and execute ... put empty
> into fld 1
> 6. The field should go blank
> 7. Click on the cells into which you previously
> input data.
> 8. Like magic your numbers reappear in the cell
> while it is being edited.
> 
> Second round ...
> 1. Open the message and execute .... put "TEST" into
> line 3 of fld 1
> 2. "Test" appears in row 3 column 1
> 3. Click on it and you will see the number you
> entered and then wiped out 
> earlier and not "TEST"
> 
> Third round ...
> 1. Open the message box and execute ... put empty
> into fld 1
> 2. Click on row 2 column 1
> 3. One of the earlier numbers should appear. Type
> over it with another number.
> 4. All the earlier numbers appear.
> 
> Fourth round ...
> 1. Use the "Popup Menu" button  and draw a quick
> button off to the side.
> 2. Go into the Inspector and give it some Menu Items
> (how about A, B, C, and 
> D each on a sep. line) 
> 3. Select line 2 of column 1 but don't change
> anything.
> 4. Click on your pop up button and watch it party
> again.
> 
> I'm very open to suggestions! Feel free to point out
> something simple like ...
>   set tableNotBuggy to true
> ... I'm not too proud for anything at this point.
> 

Hi Chris,

When you're dealing with table fields, the actual data
is stored not only in the field text, but also in two
separate custom poperties of the field :
  the cREVTable["currentview"]
  the cREVTable["formattedview"]

And of course the revTable frontScript works with
these internal data structures rather than the actual
text of the field, and will happily overwrite the text
with its own data when it gets a chance?

Now how do we use this knowledge ?
  -- build the (unformatted) data for the table
  --  column per column, row by row
  --  note that it wants an extra return at the end
  put "1" & tab & "foo" & return & \
      "2" & tab & "bar" & return into tTableData
  -- update the 'basic' table data :
  set the cREVTable["currentview"] of field "snafu" \
      to tTableData
  -- and tell it to format our data and redraw
  revDisplayFormattedData field "foobar"

Hope this helped,

Jan Schenkel.

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

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com



More information about the use-livecode mailing list