I couldn't get the mouse to change appearance while being pressed, so I think you'll need a work-around. What I would suggest is to simulate the mouse with a graphics Inset
that looks like an arrow and follows the mouse, while making the actual mouse cursor invisible for the entire time the mouse is inside the object.
This works only if the object is changed from your simple Framed
to a Graphics
object, and the code is certainly a bit more complicated that I would have liked:
DynamicModule[{
mysz,
mouse =
Graphics[{Arrowheads[1.4], Arrow[{{0, 0}, {-.5, 1}}]},
ImageSize -> 8], n},
mysz = mouse;
Dynamic[MouseAppearance[#, " "] &@EventHandler[
Graphics[{Orange, Rectangle[{0, 0}, {1, 1}], Black, Inset["A"],
Inset[mysz, MousePosition["Graphics", {-1, -1}]]},
ImageSize -> 30, PlotRange -> {{0, 1}, {0, 1}}],
{"MouseUp" :> (mysz = mouse),
"MouseDown" :> (mysz = "A";)}]
]
]
The EvenetHandler
logic is essentially the same as what you had already, but instead of mysz
determining the appearance of the mouse, it sets the Inset
that follows the MousePosition
. This seems to work fine in principle, except for a new glitch that sometimes happens when the mouse position isn't correctly tracked as you enter the Graphics from the bottom
. I just asked a separate question about this, and it could be that it's localized to version 9 of Mathematica and Mac OS X.
But apart from that, when I press the mouse it causes the simulated cursor to change to A
immediately, and the A
can also follow while dragging.