Tab in tables and determine which cell
Ken Ray
kray at sonsothunder.com
Mon Apr 28 11:38:38 EDT 2008
> In the script below revGetCellName was used.
> Where can I read about table cells and cell names
> of anything else related to table fields because I
> cannot find this word in the dictionary or anything
> when I do a search.
Last night, Bill asked me how I ended up getting to the solution; I've
restated it below (edited for clarity) to help in anyone looking to work
with tables in Rev:
------
- I knew the table field in Rev wasn't a real separate table object, it's a
field object with scripts to make it work like a table, so it made sense to
me that it would need to intercept events from the user in order to work.
This must be done with frontScripts.
- I turned on "Revolution UI Elements in Lists" (View menu) and then
displayed the list of frontScripts in the Message Box (3rd icon from the
right in the icon bar of the Message Box), and found "revTable", which I
opened.
- I then looked in the script for standard UI event handlers (mouseDown,
focusIn, etc.) to see what user events were being trapped. I was interested
in when a user clicked and when they tabbed from cell to sell, so I
concentrated on the "mouse" event handlers and the "tabKey" event handler.
- I kind of visually traced what would happen if I clicked (or tabbed) to
see what revTable handlers were being called, and eventually identified
"revUpdateCellValue" as an event that would be sent to the target, so I
could grab hold of it in my own scripts.
- For the mouse messages, I noticed that the mouseUp was being trapped and
passed, and so I was able to trap that one as well.
- The only tricky thing was that "revUpdateCellValue" is sent while tabbing
from one cell to another, but the parameters it gets are based on the cell
it just *left*, so I needed to send a delayed message, and then query where
it was after it got to the next cell.
------
Hope this helps,
More information about the use-livecode
mailing list