TEKey
TEKey Insert a key into an edit record
#include <TextEdit.h> TextEdit
void TEKey(key, hTE );
char theKey ; the character to insert
TEHandle hTE ; handle of an edit record
The TEKey procedure replaces the selection range in the specified text with a
given character and leaves an insertion point just past the inserted character.
The TEKey procedure was modified in System 6.0 so that it no longer deletes
a style if the user backspaces to the beginning of a style. Instead, TEKey saves
the style in the nullScrap field of the null style record ( defined by the
NullStRec data type) to be applied to subsequent typed characters. As soon as
the user backspaces past the beginning of the style or clicks in another area of
the text, TEKey removes the style.
TEKey inserts a specified character or replaces the current selection range
with a character. The text of the edit record is redrawn if necessary.
theKey is any character, typically a character obtained when the
GetNextEvent function indicates a keystroke.
The Backspace key (character code 0x08) is treated as a control
action. It causes the current selection range to be deleted. If no range
is selected, it deletes the character directly to the left of the
insertion point.
hTE is a handle to the edit record. The key parameter indicates the
character with which you wish to replace the selection range
specified by hTE.
Returns: none

Notes: This function adds user-input text to an edit record. The
normal sequence is to call GetNextEvent and examine the fields of the
returned EventRecord packet. On keyDown events, the message field will
contain the character code to be used as the theKey parameter for this
function.
It is the responsibility of the application program to filter out (disregard)
non-printing keystrokes, such as - or option-shifted keystrokes.
On style-aware edit records (see TEStylNew), the style of the
overwritten text (when the selection range in non-zero) or of the null style
(TEStyleRec.nullStyle) will be applied to the inserted character.
On 128K ROMs, call TEAutoView(TRUE,...) so that text will scroll into
view when the user types text beyond the view rectangle.