[R] locator(n=0)

Barry Rowlingson B.Rowlingson at lancaster.ac.uk
Fri Feb 27 12:04:03 CET 2004

Peter Wolf wrote:
> locator(n=1) returns the coordinates of the position of the mouse.
> But you have to click the left button of the mouse.
> How can I determine the mouse position without any click?
> Is it possible to extend locator in a way that  locator(n=0) outputs the 
> coordinates at once, without any click event?

  I just took twenty minutes to bash devX11.c newX11_Locator routine 
into using XQueryPointer instead of waiting for a mouse event. That 
breaks the 'click to enter point' behaviour though. I couldn't figure 
out how to quickly modify things to just do this for n=0. I cant do 
everything in the twenty mins before morning tea break.

  Its a gross hack, and as Brian says, there's nothing in the design 
that lets you do this, but then since you have the source there's 
nothing on the planet to stop you doing this. The design is not a law :)

  The beauty of open-source code eh? If you really want to do this its 
quite easy. Mail me for more details.


More information about the R-help mailing list