my problem is with combining EventHandler and MouseAppearance. I want to change cursor appearance if I have primary button pressed over on item. But only then, after releasing it should be "Arrow" back.

but it doesn't.
The strange thing is, using "MouseClicked" it works, of course effect is different, it works like it should.
Second thing is variable "mysz" is updated to "A" while button is pressed... but appearance doesn't change.

1 Answer
1

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:

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.

Yes, Your way works. But it won't help me. General idea is to have many items with this function on the field, those items will differ with size, position and mousegraphic. I had similar to Yours solution earlier but it is not convinient to use standard positioning. I want to set things buy Grid or sth. Thats why I left Graphics way.
–
KubaJan 21 '13 at 10:41

But what is even more important than the solution is WHY it does not work? :) In my opinion it should, something is wrong with MouseAppearance :/
–
KubaJan 21 '13 at 16:14

Sorry it won't work for you, but I don't have any better insight into the mouse appearance while it's being pressed. I tried using the drag event instead, but that didn't work either (for mouse appearance).
–
JensJan 21 '13 at 17:06

I decided to accept your answer finally because even though it is a workaround I couldn't find better then mine previous and I believe yours will be useful for future visitors.
–
KubaSep 11 '13 at 7:28

Mathematica is a registered trademark of Wolfram Research, Inc. While the mark is used herein with the limited permission of Wolfram Research, Stack Exchange and this site disclaim all affiliation therewith.