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 7 - Text Services Manager / Text Services Manager Reference
Apple Event Handlers Supplied by Client Applications


Converting Text Offsets to Global Coordinates

The Offset To Position Apple event requests that a client application convert byte offsets in text to global coordinates. The text service component uses this Apple event to determine where in the active input area to draw an element (such as the caret or a palette of conversion choices) that relates to a particular character.
Offset To Position--Converting Text Offsets to Global Coordinates (Continued)
Event classkTextServiceClass
Event IDkOffset2Pos
Requested actionConvert a specified byte offset into global coordinates. The offset value passed to the client application is relative to the start of the active input area. If there is no active input area, the offset is relative to the start of the current text body.
 
Required parameters
Keyword:keyAETSMDocumentRefcon
Descriptor type:typeLongInteger
Data:A TSM document specifier (reference constant) supplied by the application in a prior call to the NewTSMDocument function (see page 7-50). This value is associated with the TSM document affected by this event.
Required parameters
Keyword:keyAEServerInstance
Descriptor type:typeComponentInstance
Data:A component instance value returned by a prior call to the Component Manager OpenComponent function. This value identifies the text service component.
Keyword:keyAEOffset
Descriptor type:typeLongInteger
Data:The text offset to be converted into a global point. Offset is in terms of bytes from the start of the active input area.
Return parameters
Keyword:keyAEPoint
Descriptor type:typePoint
Data:A point that contains the global coordinates obtained by converting the byte offset passed in the keyAEOffset parameter.
Keyword:keyErrorNumber
Descriptor type:typeShortInteger
Data:errOffsetInvalid indicates that there is no text at the offset. errOffsetIsOutsideOfView indicates that the text offset is out of view.

The application must pass Memory Manager, TextEdit, or other errors that it receives through to the component; otherwise, it should pass 0 (noErr).

Optional return parameters
Keyword:keyAETextFont
Descriptor type:typeLongInteger
Data:The font of the text in the active input area. The application can send this information to the input method to help the input method position the active input area.
Keyword:keyAETextPointSize
Descriptor type:typeFixed
Data:The size of the text in the active input area. The application can send this information to the input method to help the input method position the active input area.
Keyword:keyAETextLineHeight
Descriptor type:typeShortInteger
Data:The line height of the text in the active input area. The application can send this information to the input method to help the input method position the active input area.
  
Optional return parameters
Keyword:keyAETextLineAscent
Descriptor type:typeShortInteger
Data:The ascent height of the text in the active input area. The application can send this information to the input method to help the input method position the active input area.
Keyword:keyAEAngle
Descriptor type:typeFixed
Data:The orientation of the text in the active input area. The value 90 specifies a horizontal line direction and 180 specifies a vertical line direction. The application can send this information to the input method to help the input method position the active input area.

For sample code that handles the Offset To Position Apple event, see Listing 7-9 on page 7-33.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996