Where is leftButton/rightButton variables in imageJ macro?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Where is leftButton/rightButton variables in imageJ macro?

moosekaka
Hi,

I am trying to extend the getCursorLoc() function in imageJ macro to include
other keys, other than just the default Shift,Ctrl,Alt,
leftButton,rightButton found in the getCursorLoc demo. Where can I find the
where these variables are stored in imageJ? For example how do I add
Spacebar?

I have figured out that the flags are additive, eg if Shift=1,leftButton=16,
than Shift+left button returns 17 on the flag variable. Problem is that Alt
button inteferes with some functions on the ROImanager and I need a way to
get around this. thanks!

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Where is leftButton/rightButton variables in imageJ macro?

Michael Schmid
Hi Lim,

the keys reported by getCursorLoc() are those of the Java InputEvent class:
  http://docs.oracle.com/javase/1.5.0/docs/api/java/awt/event/InputEvent.html

For the numerical values, see
  docs.oracle.com/javase/1.5.0/docs/api/constant-values.html#java.awt.event.InputEvent.ALT_DOWN_MASK
The latter is a very large web page, may take ages to load with a slow web connection, so I'll copy the relevant part to this mail:

ALT_DOWN_MASK 512
ALT_GRAPH_DOWN_MASK 8192
ALT_GRAPH_MASK 32
ALT_MASK 8
BUTTON1_DOWN_MASK 1024
BUTTON1_MASK 16
BUTTON2_DOWN_MASK 2048
BUTTON2_MASK 8
BUTTON3_DOWN_MASK 4096
BUTTON3_MASK 4
CTRL_DOWN_MASK 128
CTRL_MASK 2
META_DOWN_MASK 256
META_MASK 4
SHIFT_DOWN_MASK 64
SHIFT_MASK 1

You should use the values named ..._DOWN_MASK, not those without 'DOWN'.
Note that some keys like ALT-GR (ALT_GRAPH, alternate graphics) are not necessarily available on all platforms.

Michael
________________________________________________________________
On Oct 3, 2012, at 00:20, Swee Lim wrote:

> Hi,
>
> I am trying to extend the getCursorLoc() function in imageJ macro to include
> other keys, other than just the default Shift,Ctrl,Alt,
> leftButton,rightButton found in the getCursorLoc demo. Where can I find the
> where these variables are stored in imageJ? For example how do I add
> Spacebar?
>
> I have figured out that the flags are additive, eg if Shift=1,leftButton=16,
> than Shift+left button returns 17 on the flag variable. Problem is that Alt
> button inteferes with some functions on the ROImanager and I need a way to
> get around this. thanks!
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html