Buy the book!
|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
Sometimes it is useful to track the mouse, which means to display something to indicate where the mouse is and move the indicator as the mouse moves. For efficient mouse tracking, you need a way to wait until the mouse actually moves.
The convenient way to track the mouse is to ask for events to represent mouse motion. Then you can wait for motion by waiting for an event. In addition, you can easily handle any other sorts of events that may occur. That is useful, because normally you don't want to track the mouse forever--only until some other event, such as the release of a button.
read-eventto read the motion events and modify the display accordingly. See section 21.6.8 Motion Events, for the format of mouse motion events.
The value of
track-mouse is that of the last form in body.
You should design body to return when it sees the up-event that
indicates the release of the button, or whatever kind of event means
it is time to stop tracking.
The usual purpose of tracking mouse motion is to indicate on the screen the consequences of pushing or releasing a button at the current position.
In many cases, you can avoid the need to track the mouse by using
mouse-face text property (see section 32.19.4 Properties with Special Meanings).
That works at a much lower level and runs more smoothly than
Lisp-level mouse tracking.
|webmaster donations bookstore||delorie software privacy|
|Copyright © 2003 by The Free Software Foundation||Updated Jun 2003|