9
$\begingroup$

Using MouseAppearance one can change the cursor image when passing over an expression.

Is it possible to change the cursor image for the entire notebook front end (not just one expression within it)?

$\endgroup$
  • $\begingroup$ Theres a FrontEnd`SetMouseAppearance that I have no idea how to use $\endgroup$ – Rojo Feb 11 '12 at 20:25
  • $\begingroup$ There is also MousePointerAppearance in the options inspector. It only seems to respond to None and Automatic however. I haven't been able to make it accept Graphics for example. $\endgroup$ – Andy Ross Feb 11 '12 at 20:31
  • $\begingroup$ I am looking for a similar setup. When the user clicks a button I want to set MouseAppearance to busy expression while the file is being written and then change it back to Automatic. $\endgroup$ – Edmund Aug 10 '16 at 13:34
2
$\begingroup$

One can change the default cursor for all Output by setting up $Post with something like the following.

mouseApp[expr_] := 
      MouseAppearance[expr, Graphics[{Red, Disk[]}, ImageSize -> 10]]

$Post = mouseApp;

I'm not sure this answers your question though since it doesn't change the appearance of the mouse cursor for Input.

$\endgroup$
  • 1
    $\begingroup$ I'm building an application where the interface has several buttons (on a docked cell). Pressing a button "activates an action" in the sense that the user will be able to perform something to the next element he clicks on the "front end". While this "action" is active, I wanted the cursor to have a specific image: a bomb, a green tick, a red cross, etc. Obviously, I could just have the cursor change over the actual elements of the front end to which the action actually can impact, but this means the cursor will be constantly changing, which is more confusing to the user than helpful. $\endgroup$ – P. Fonseca Feb 11 '12 at 21:07
  • $\begingroup$ @Andy Sorry, I didn't notice that ... I'm deleting my comment. $\endgroup$ – Szabolcs Feb 11 '12 at 23:30
2
$\begingroup$

FrontEndExecute@FrontEnd`SetMouseAppearance[literally_anything] does it for you.

It seems to just rasterize the expression and then set it as the mouse cursor. Works until something tries to change the cursor (like a resize grip as you leave the window).

Clicking also makes it disappear, although I bet with more testing we can find an option that makes that not be the case.

Here's a way to make your cursor caffeine:

FrontEndExecute@FrontEnd`SetMouseAppearance[
  ChemicalData["Caffeine", "SpaceFillingMoleculePlot"]]

Note that text doesn't make for great cursors due to something about the rasterization.

(Beware the twin packet FrontEnd`GetMouseAppearance. It crashes the system if you don't pass it an object. Seems as if it's used for getting icon images. Try: FrontEnd`Execute@FrontEnd`GetMouseAppearance@"Hand").

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.