Important: The information in this document is obsolete and should not be used for new development.
TEKey
TheTEKey
procedure 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,TEKey
inserts the character. (Two-byte characters are passed one byte at a time.) If thekey
parameter 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,
TEKey
saves 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,TEKey
removes the attributes.TEKey
redraws the text as necessary.Call
TEKey
every time the Event Manager functionWaitNextEvent
reports a keyboard event that your application determines should be handled by TextEdit.Because
TEKey
inserts every character passed in thekey
parameter, 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 theWaitNextEvent
function, see the chapter "Event Manager" in Inside Macintosh: Macintosh Toolbox Essentials.