Important: The information in this document is obsolete and should not be used for new development.
TEKey
TheTEKeyprocedure replaces the selection range in the text of the specified edit record with the input character and positions the insertion point just past the inserted character.
PROCEDURE TEKey (key: Char; hTE: TEHandle);
key- The input character.
hTE- A handle to the edit record in whose text the character is to be entered.
DESCRIPTION
If the selection range is an insertion point,TEKeyinserts the character. (Two-byte characters are passed one byte at a time.) If thekeyparameter contains a backspace character, the selection range or the character immediately before the insertion point is deleted. When the primary line direction is right-to-left, the character to the right of the insertion point is deleted. When the primary line direction is left-to-right, the character to the left of the insertion point is deleted.When the user deletes text up to the beginning of a set of character attributes,
TEKeysaves the attributes in the null scrap's style scrap record. The attributes are saved temporarily to be applied to characters inserted after the deletion. As soon as the user clicks in another area of the text,TEKeyremoves the attributes.TEKeyredraws the text as necessary.Call
TEKeyevery time the Event Manager functionWaitNextEventreports a keyboard event that your application determines should be handled by TextEdit.Because
TEKeyinserts every character passed in thekeyparameter, your application must filter all characters which aren't actual text, such as keys typed in conjunction with the Command key.SEE ALSO
For a description of theWaitNextEventfunction, see the chapter "Event Manager" in Inside Macintosh: Macintosh Toolbox Essentials.