Mac OS X Reference Library Apple Developer
Search

Accessing Dictionaries

Although the Dictionary Services programming interface provides only a few functions, these functions provide two valuable services. You can:

Getting a Definition

There are two steps you need to perform to get a definition:

  1. Call the function DCSGetTermRangeInString to obtain the range in a dictionary that contains the definition for a word or phrase.

  2. Pass that range to the function DCSCopyTextDefinition to get the definition associated with the text range and word or phrase. Dictionary Services returns the definition as a CFString object, which is plain text.

An alternative to getting the definition returned to you is to let Dictionary Services obtain and display the search results for you. In this case, instead of calling DCSCopyTextDefinition, you would pass the text range to the HIDictionaryWindowShow function.

Supporting Contextual Lookup

You may want to user the HIDictionaryWindowShow function to support contextual look-up in any application that provides text editing. For example, you could set up your application to respond as follows when the user control-clicks a text selection:

For More Information

Dictionary Services Reference describes functions and their parameters in detail.




Last updated: 2007-05-30

Did this document help you? Yes It's good, but... Not helpful...