restricting chars in a field

mark mitchell cowhead at mac.com
Thu Sep 26 12:03:50 CDT 2002


robert wrote:

> Appreciate any  suggestions that would replace the following script,
> that I used in SuperCard, to one in Revolution.  Want to enter only
> certain chars into a field.

I'm sure there are many ways, but one way I have used to do this is to 
use a CARD script, instead of a field, and only pass the keydown message 
if the appropriate key is pressed

eg.

on keyDown whichkey
if the focusedObject is myField then -- this should let you have 
different key restrictions for multiple fields on 1 								card, but I never 
got it to work :-)  Requires long ID of the field...
if whichKey is theKeyYouWant then --  can also use 'is not'  'is among' 
etc here, you don't need numToChar or 							anything here...just type the 
keyname straight eg. "y"
pass keydown
end if
else
pass keyDown
end if

good luck!

mark mitchell
Japan




More information about the use-livecode mailing list