Tab in tables and determine which cell
Bill Vlahos
bvlahos at mac.com
Mon Apr 28 01:32:35 EDT 2008
Thanks to JB for his suggestions on keeping count but Ken Ray came up
with a more elegant solution. I'm not sure why Rev hasn't documented
this.
Thanks,
Bill Vlahos
> Here you go, Bill... after some research, it turns out that Rev
> doesn't
> give you too many messages to work with in their "table" field.
> However I
> found that we can get what we want by putting the attached code into
> the
> *card* script (or higher in the hierarchy), but not in the table field
> itself, as it won't get the messages necessary.
>
> Here's the code for the card script:
>
> ---
> on mouseUp -- Use this to trap whtn the user clicks in a cell
> put GetCellName(the long id of the target) into fld "Log"
> pass mouseUp
> end mouseUp
>
> on tabIntoCell pObj -- Use this to trap the user tabbing into a cell
> put GetCellName(pObj) into fld "Log"
> end tabIntoCell
>
> on mouseDown -- Sent when user clicks in table
> put the long id of the target into tObj
> set the uCurrentCell of tObj to GetCellName(tObj)
> end mouseDown
>
> on revUpdateCellValue pObject,txcell,tycell,tCurrentcell,tNewText
> -- Sent when user tabs to another cell or uses the arrow keys
> send "tabIntoCell pObject" to me in 20 milliseconds
> pass revUpdateCellValue
> end revUpdateCellValue
>
> function GetCellName pObj
> put revGetCellName(pObj) into tName
> replace "revCell-" with "" in tName
> return tName
> end GetCellName
> ---
>
> So use 'mouseUp' and 'tabIntoCell' to do what you want (I have the
> output
> going into a field "Log", but you can do what you want). What you
> get back
> is a row,column output (e.g. "1,2" or "4,3", etc.) that you can use
> to do
> what you need to do.
>
> Have fun!
>
> Ken
On Apr 23, 2008, at 6:41 PM, Bill Vlahos wrote:
> I have a table that users can tab through. I'd like to be able to
> determine when a user tabs into a certain column and do some action.
>
> I can determine it when the user clicks in a cell but how can I
> determine it when they tab into a cell?
>
> Bill Vlahos
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list