THINK Reference AppleEvents
THINK Reference AppleEvents
THINK Reference supports two AppleEvents that let applications look up
pages and copy templates. This section describes how to support these
AppleEvents in applications you write. To find out if an application you own
supports them, read the application documentation.
These events do not launch THINK Reference. If you are not sure if THINK
Reference is running, make sure to call LaunchApplication.
Looking up a page
Event Class: 'DanR'
Event ID: 'REF ' (note the space)
This event looks up a page in THINK Reference. It opens up to the page, and
leaves the user in THINK Reference.
It takes two paramters, one is optional:
Type Parameter Keyword
typeChar keyDirectObject
typeProcessSerialNumber keyProcessSerialNumber
The first parameter is a string that contains the name of the page you want
to look up. It is a raw text string, with no leading byte count and no trailing
null-byte.
The second parameter is optional. It specifies whether the user is brought
back to your application when the user Iconizes THINK Reference. The user
sets this option in the Preferences dialog.
The event returns these values:
Value Description
noErr (0) No error
pgErr (-1) THINK Reference could not find the page name
in any of its open databases.
Copying a template
Event Class: 'DanR'
Event ID: 'TMPL'
This event returns the template and Inside Macintosh page number, and a
return code. The return code indicates the contents of the template string, if
any.
This event never brings THINK Reference to the front. If THINK Reference
needs to interact with the user (for example, to ask the user to locate the
databases), it returns an error.
It takes one parameter:
Type Parameter Keyword
typeChar keyDirectObject
The parameter is a string that contains the name of the function you want
the template for. It is a raw text string, with no leading byte count and no
trailing null-byte.
It returns:
Type Parameter Keyword
typeChar keyDirectObject
The return string is a raw text string, with no leading byte count and no
trailing null-byte.
This is an example return value:
AddPt(srcPt, &destPt); /*IM I pg 193*/
The event can return these error values:
Value Description
noErr (0) THINK Reference found the page, the page has
a template, and possibly an Inside Macintosh
page number.
pgErr (-1) THINK Reference could not find the function in
any of its databases.
dbErr (-2) THINK Reference could not find its databases.
tmplFailErr (-4) THINK Reference didn't have a template or
Inside Macintosh page number for the
function.
tmplIMXrefOnly (-5) THINK Reference didn't have a template, but it
did return an Inside Macintosh page number.
If THINK Reference requires user interaction through the Standard File
box, and the user hits the Cancel button, THINK Reference quits, and does not
return any error. You should include some small timeout value when
sending an AppleEvent to make sure your program does not hang if THINK
Reference does not complete the AppleEvent. Since the 'REF ' event is the
only event that allows user interaction, this is the only event that you need
to worry about timeouts.