Another dumb table question

Graham Samuel livfoss at blueyonder.co.uk
Tue Jun 3 04:53:03 EDT 2003


On Mon, 2 Jun 2003 22:42:54 -0700 (PDT) Jan Schenkel 
<janschenkel at yahoo.com> wrote:

>I wrote:
>  > Am I missing something? When I do finally understand
>>  that the user
>>  has left one cell and proceeded to another, how can
>>  I retrieve the
>>  contents of the cell that the user has just left (on
>>  the assumption
>  > that it's changed)?
>>
>
>
>Hi Graham,
>
>Sniffing around in the revTable frontScript taught me
>that the table-field will not receive arrowKey and
>tabKey messages as it handles those directly.
>However, you can trap the rawKeyDown in your field
>script to find out how the user changed the cell
>selection :
>
>--
>
>local sLastSelectedCell
>
>on rawKeyDown pWhichKey
>   send "CheckCellChange" to me in 20 milliseconds
>   pass rawKeyDown
>end rawKeyDown
>
>on CheckCellChange
>   put the cREVTable["currentxcell"] of me & comma & \
>       the cREVTable["currentycell"] of me into tCell
>   if tCell is not sLastSelectedCell then
>     -- the selection changed
>     put tCell into sLastSelectedCell
>     CellSelectionChanged tCell
>   end if
>end CheckCellChange
>
>on CellSelectionChanged pNewCell
>   -- react to the change in cell selection
>end CellSelectionChanged
>
>--
>
>Hope this helped,
>
Wow! I would NEVER have found this out without your intervention. 
The documentation of tables is seriously deficient IMHO - or my idea 
of what a table is for (user input and subsequent manipulation by the 
app's script) is way off somehow. Your info comes from looking under 
the hood in the RR code, which I would think of very much as a last 
resort - I didn't even know there was a revTable frontscript, or that 
the cell references and contents are held internally in an array!

Anyway thanks very much indeed.

Graham
-- 
-------------------------------------------------------------------
          Graham Samuel / The Living Fossil Co. / UK & France



More information about the use-livecode mailing list