catching closeField and keyUp type events in regular table

Richmond richmondmathewson at gmail.com
Sat Apr 12 18:36:39 CEST 2014


On 12/04/14 19:06, Dr. Hawkins wrote:
> I want to catch the tabkey and closefield equivalents in a regular table to
> manipulate it, and perform some calculations.
>
> As I understand from other posts, there are frontscripts in button
> "revTable" of group "revLibraries" of stack "revLibrary"
>
> But what do I need to do to catch these (and not to shoot my foot off!).
>
> This is a two-column table, for optional labels and for amounts.  It may
> get arbitrarily long (so it scrolls), but a couple of dozen entries would
> be very rare.
>
> So I want to move any numeric entry in the left column immediately to the
> right and reposition, sum the second column, and so forth.  And to notife
> when I eave the table entirely.
>
> If I can catch the messages corresponding to closefield, arrowkey, and
> tabkey, I already have all the handlers I need.
>
> Also, I find that when I *do* manage to catch a closefield on leaving the
> table, it gets called twice, once for the table, and once for the revcell
> (which I am currently trapping).
>
>
>

I assume (dangerous business), that, in the cardScript of the card that 
holds your table
one could have this sort of thing:

on keyUp KUP
    if KUP =

wait a minute; scrub that . . . let's go for rawKeyUp:

on rawKeyUp RUP
    if RUP = 65289 then
     --  do whatever fancy things you want
    end if
     -- trap left arrowKey
    if RUP = 65361 then
    --  do whatever fancy things you want
    end if
    -- have further routines to trap the other arrow keys
end rawKeyUp

[if that doesn't thrill your gorilla overmuch, consider using a switch 
statement]

I suppose you would have to have this sort of script in the field's script:

on closeField
   -- do whatever you fancy
end closeField

Richmond.



More information about the use-livecode mailing list