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
Text Services Manager Routines for Client Applications / Creating and Activating TSM Documents


NewTSMDocument

The NewTSMDocument function creates a TSM document and returns a handle to the document's ID.

FUNCTION NewTSMDocument (numOfInterface: Integer; 
                         VAR supportedInterfaceTypes: 
                         InterfaceTypeList; 
                         VAR idocID: TSMDocumentID; 
                         refCon: LongInt): OSErr;
numOfInterface
The number of supported text service interface types. Currently, this number must be 1.
supportedInterfaceTypes
A list of supported interface types. This list helps the Text Services Manager to locate the text services that have the correct interface type. Currently, the Text Services Manager has defined one interface type: kTextService ( = 'tsvc'). The data type InterfaceTypeList is a simple array of 4-character (OSType) tags.
idocID
Upon successful completion of the call, contains the document identification number of the TSM document created.
refCon
A reference constant to store in the TSM document record. It may have any value you wish.
DESCRIPTION
Each time your client application calls the NewTSMDocument function, the Text Services Manager creates an internal record called a TSM document and returns its ID.

If the call is successful, NewTSMDocument opens the default input method text service component of the current keyboard script and assigns it to this document. If NewTSMDocument returns tsmScriptHasNoIMErr, it has still created a valid TSM document, but has not associated an input method with it.

If NewTSMDocument fails to create a new TSM document, it returns an error and sets idocID to NIL.

RESULT CODES
noErrNo error
memFullErrInsufficient memory to open document
tsmUnsupportedTypeErrSupported type was not 'tsvc'
tsmNeverRegisteredErrApplication is not TSM-aware
tsmScriptHasNoIMErrCurrent script does not use input methods
tsmCantOpenComponentErrCannot open default input of current script
SEE ALSO
For sample code that uses the NewTSMDocument function, see Listing 7-2 on page 7-19.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996