slowness of "on keyUp" script

Mike Bonner bonnmike at gmail.com
Sun Jul 1 12:31:11 EDT 2012


Does this work better for you?

on keydown pKey
   if the length of me < 9 and  pKey is a number then
      pass keydown
   else
      beep
   end if
end keydown
command doHyphens
   if not offset("-",me) then
      put "-" after char 5 of me
      put "-" after char 3 of me
   end if
end doHyphens

on openfield
   replace "-" with empty in me
end openfield

on closefield
   doHyphens
end closefield
on exitfield
   doHyphens
end exitfield

On Sun, Jul 1, 2012 at 10:14 AM, Dr. Hawkins <dochawk at gmail.com> wrote:

> I' surprised at how slow this is--I can type fast enough to foul it.
>
> American social security numbers have nine digits, with a dash after
> the third and fifth.
>
> I attached this to a field to handle it automatically
>
> on keyUp theKey
>    if the length of me = 3 or the length of me=6 then put "-" after me
>    if theKey is among the chars of "0123456789" then
>       pass keyup
>    else
>       beep
>    end if
>
> end keyUp
>
> If I blast a bunch of numbers on the keyboard at once, I get extra
> numbers before the hyphens: right now it shows 873124-6758021394
>
>
> --
> The Hawkins Law Firm
> Richard E. Hawkins, Esq.
> (702) 508-8462
> HawkinsLawFirm at gmail.com
> 3025 S. Maryland Parkway
> Suite A
> Las Vegas, NV  89109
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list