I'm trying to make an interface that (basically) records what mouse button was pressed inside the cell of a matrix.
The code I have so far is
A = ConstantArray[0, {10, 10}];
DynamicModule[{pt = {0, 0}}, Dynamic@EventHandler[ArrayPlot[A],
"MouseDown" :> (
A[[
Ceiling[10 - MousePosition["Graphics"][[2]]],
Ceiling[MousePosition["Graphics"][[1]]]
]] = CurrentValue["MouseButtons"])]]
It kind of works, except that CurrentValue["MouseButtons"] seems to be returning strange things: it returns {1} for my left mouse button, empty set {} for my right mouse button, and nothing happens when I click my scrollwheel/middle mouse button. Why is that? Shouldn't I be getting something like 1 for left mouse, 2 for right mouse, and 3 for middle mouse buttons (at least according to the documentation)? My mouse seems to be working fine.
Thanks for any help!
Comments
Post a Comment