Arbortext Command Language > Callbacks > doc_add_callback > link Callback Type
  
link Callback Type
Function prototype:
function funcname (doc, oid, pos, op)
link is called by the link command before the link action is taken, except for URI links. See the callback type linkuri for additional information.
Arguments
doc is the identifier of the current document.
oid is the object identifier representing the current mouse (if link mouse) or caret (if link caret) position.
pos is the position from oid in characters of the mouse or cursor as returned by oid_mouse_pos(oid) or oid_caret_pos(oid).
op is the function callback operation. Callbacks are called twice in succession with op specifying the stage of callback operation.
1. op == 1 first call — The returned argument specifies whether the execution should continue or be stopped:
0 — Continue callback processing.
-1 — Stop further callback processing.
2. op == 2 second call — Occurs unless the processing was stopped during the first call. The returned argument allows or prevents basic Arbortext Editor processing after all callbacks have been called:
0 — Basic Arbortext Editor processing allowed.
-1 — Basic Arbortext Editor processing prevented.
The callback function must return -1 if it performs the link action; otherwise it should return 0 to let Arbortext Editor complete its normal processing.
* 
By default, double-clicking the left mouse button is mapped to a function that executes a link command. If it returns failure (meaning there is no object to link to), double-click the current word. A link callback function must not interfere with this operation. (That is, if it returns -1, it must perform a link.)