Arbortext Command Language > Functions by Alphabetical Listing > oid_mouse_pos
  
oid_mouse_pos
$oid = oid_mouse_pos (pos[, doc[, flag]])
This function returns the oid corresponding to the current mouse position. If the mouse pointer is pointing directly at the begin or end tag of an element, the oid returned corresponds to that element.
The pos parameter is an output variable to hold the character offset from the element's start tag to the character closest to the mouse pointer.
The doc parameter specifies the document to operate upon. If doc is omitted or 0, the value returned by current_doc is used.
When the mouse pointer is not pointed directly at the begin or end tag of an element, the value of flag has no effect. But when the mouse pointer is pointed directly at the begin or end tag of an element, flag works as follows:
If flag is 1, then oid_mouse_pos evaluates whether the mouse pointer is closer to the left or right side of a tag. The function will return the oid that is outside the tag pair if the mouse is pointing at the left half of the begin tag or the right half of the end tag.
If flag is omitted or 0, then oid_mouse_pos returns the oid which is inside the tag under the mouse pointer.
The following code will produce a result similar to the command caret mouse, unless the mouse is pointing directly at a begin or end tag. If the mouse is pointing directly at a begin or end tag, the caret will always be positioned inside the tag pair. With the caret mouse command, however, the caret will be positioned outside the tag pair if the mouse is pointing at the left half of the begin tag or the right half of the end tag.
local oid, pos
oid = oid_mouse_pos(pos)
goto_oid(oid, pos)