on keyPressed <thecharacter>, <selectionstart>,
Sent to fields _______________________________________ Description:
The keyPressed message is sent when a key is pressed in a field. <thecharacter> is the key that is pressed.
If text in the field is selected, <selectionstart> is the position of the first character of the selection and <selectionend> is the position of the last character of the selection. If you pass keyPressed, the selected text is replaced by the character typed.
When the user types while the selection point is blinking in a field (that is, there is no selection), <selectionstart> is the position of the character after the insertion point, and <selectionend> has a value that is one less than the value of <selectionstart>. If you pass keyPressed, the character is inserted at the insertion point.
This message may be intercepted to implement custom validation. Don't forget to use pass keyPressed, or what the user types will not appear.
The following handler, placed in a field's script, intercepts the keyPressed message to restrict data entry into the field to the alphabetic characters (A-Z, a-z):
on keyPressed whichKey
-- check for A-Z (ASCII 65-90)
91 then pass keyPressed -- check for a-z
123 then pass keyPressed
This text has been mechanically extracted from the Oracle Media Objects 184.108.40.206 MediaTalk Reference, © 1995 Oracle Corporation, and is provided here solely for educational/historical purposes.