[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section describes convenient functions for accessing the data in a mouse button or motion event.
These two functions return the starting or ending position of a mouse-button event, as a list of this form:
(window buffer-position (x . y) timestamp) |
If event is a click or button-down event, this returns the location of the event. If event is a drag event, this returns the drag's starting position.
If event is a drag event, this returns the position where the user released the mouse button. If event is a click or button-down event, the value is actually the starting position, which is the only position such events have.
These five functions take a position list as described above, and return various parts of it.
(x . y)
.
(col . row)
. These are computed from the
x and y values actually found in position.
These functions are useful for decoding scroll bar events.
(portion . whole)
containing two integers whose ratio
is the fractional position.
(num . denom)
---typically a
value returned by scroll-bar-event-ratio
.
This function is handy for scaling a position on a scroll bar into a buffer position. Here's how to do that:
(+ (point-min) (scroll-bar-scale (posn-x-y (event-start event)) (- (point-max) (point-min)))) |
Recall that scroll bar events have two integers forming a ratio, in place of a pair of x and y coordinates.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |