Another dumb table question
Jan Schenkel
janschenkel at yahoo.com
Tue Jun 3 00:51:01 EDT 2003
--- Graham Samuel <livfoss at blueyonder.co.uk> wrote:
> I guess this is obvious, but how do I know when the
> user tabs (or
> returns or arrow-keys) to another cell in a table? I
> started testing
> this by trying to intercept the 'tabKey' message in
> the table's
> script, but it apparently wasn't sent. I thought it
> would be, because
> of this in the TD:
>
> "Handle the tabKey message when you want to perform
> an action (such
> as going to the next card) when the user presses the
> Tab key.
>
> Comments:
> The message is sent to the active (focused) control,
> or to the
> current card if no control is focused. "
>
> 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)?
>
> Dumb but not yet defeated.
>
> Graham
> --
>
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,
Jan Schenkel.
=====
"As we grow older, we grow both wiser and more foolish at the same time." (La Rochefoucauld)
__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
More information about the use-livecode
mailing list