Did you try placing the handler in the card script and typing into a bunch of fields?
Do it.
Now then. The keyDown message is sent from the "target", which is the field currently being typed into. On a NEW card, make two new fields and a button. We are going to set a custom property for each field, called "prohibit".
In the button script::
Code: Select all
on mouseUp
set the prohibit of fld 1 to "AB"
set the prohibit of fld 2 to "CD"
end mouseUp
In the card script:
Code: Select all
on keyDown tKey
if tKey is not in the prohibit of the target then pass keyDown
end keyDown
Click the button. Now type into each field, and see whether fld 1 will accept A or B, and whether fld 2 will accept C or D.
This is a method of separating fields into "classes", each class being able to filter only certain characters.The first class filters "AB", and the second class filters "CD". Any field can be added to any class by simply setting its prohibit property. The one line handler in the card script is all you need.
This is a compact handler that needs some thought. You may not be familiar with the parts of LC I am using, but you should be able to simply describe what is going on. So think about it, and write back with any theories you have. I want to show you the power of LiveCode, but do not want to go too fast for you. I need to know how well you are doing with this.
Craig