# set-cursor-to-mouse(2)

[Home] [Commands] [Variables] [Macro-Dev] [Glossary]

## NAME

set-cursor-to-mouse - Move the cursor to the current mouse position

## SYNOPSIS

n set-cursor-to-mouse

## DESCRIPTION

set-cursor-to-mouse sets the current window and cursor position to the location of the mouse on it's last event (button press or release). This command may change the current window. If the line on which the mouse was located was the message line then the no action is taken, if the line was a window mode line the that window is made the current window but the cursor location within the window remains the same. This is usually used in user defined macros that control the functionality of the mouse.

Invocation of this command sets the variable $mouse-pos(5) which determines where the mouse is within the window. Interrogation of the variable following the command may be used to determine if the mouse is located on one of the more specialized window or screen regions.

An argument n determines if the command is permitted to change windows and cursor position, where the bits are defined as follows:

0x01

Permit changing of the current window, if not permitted and the mouse is not in the current window set-cursor-to-mouse returns an error condition in $mouse-pos(5).

0x02

Permit changing of the cursor position.

The default argument when omitted is 3, allowing the changing of both.

When writing macros to cut and paste using the mouse, care should be taken to ensure that the window at the button release is the same is at the button press. If this is not undertaken, undesired effects could result. The use of set-position(2) and goto-position(2) are most usefully used with this command to restore existing window context.

## SEE ALSO

$mouse-pos(5), $mouse-x(5), $mouse-y(5), $window-mode-line(5), $window-scroll-bar(5), set-scroll-with-mouse(2), set-position(2), goto-position(2).

(c) Copyright JASSPA 2009
Last Modified: 2009/08/29
Generated On: 2009/10/12

</HMTL>