Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Text /
Chapter 2 - TextEdit / TextEdit Reference
Data Structures


The High Hook and Caret Hook Fields

The highHook and caretHook fields--at the offsets teHiHook and teCarHook in assembly language--contain the addresses of routines that deal with text highlighting and the caret. These routines pass parameters in registers; if you replace these routines, your application must save and restore the registers' contents.

If you store the address of a routine in teHiHook, that routine is used instead of the QuickDraw procedure InvertRect, which is called by default, whenever a selection range is to be highlighted. Your routine can destroy the contents of registers A0, A1, D0, D1, and D2. On entry, A3 is a pointer to a locked edit record; the stack contains the rectangle enclosing the text being highlighted. (Use of the A3 register is equivalent to the InvertRect r parameter of type RECT. See the QuickDraw chapters in Inside Macintosh: Imaging for more information about the InvertRect procedure.) For example, if you store the address of the following routine in teHiHook, selection range is underlined instead of inverted.

UnderHigh
   MOVE.L   4(SP),A0             ;get address of rectangle to be
                                 ;highlighted
   MOVE     bottom(A0),top(A0)   ;make the top coordinate equal to
   SUBQ     #1,top(A0)           ;the bottom coordinate minus 1
   _InverRect                    ;invert the resulting rectangle
   RTS
The routine whose address is stored in teCarHook acts exactly the same way as the teHiHook routine, but on the caret instead of the selection range, allowing you to change the appearance of the caret. The routine is called with the stack containing the rectangle address that encloses the caret.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996