I want to create a custom shortcut triggered by clicking (not rolling) the middle mouse button. But a seemingly trivial question gets in the way: What is the middle mouse button called in Mathematica? (For instance, the key "6" on the numeric keypad is called "Keypad6" in Mathematica's file for shortcut configuration.) There does not seem to be any information about it either in the Documentaion or on the Interenet.

Or... can this button be detected at all by Mathematica (on Windows)?

  • $\begingroup$ In fact there were reports indicating that the middle mouse button was perhaps not recognized by Mathematica. mathematica.stackexchange.com/questions/113261/… $\endgroup$ – User18 Aug 26 '16 at 9:45
  • 1
    $\begingroup$ This might be helpful: Dynamic[CurrentValue["MouseButtons"], UpdateInterval -> 0.02]. Clicking somewhere outside the front end window works best. $\endgroup$ – Karsten 7. Aug 26 '16 at 13:23
  • $\begingroup$ @Karsten7. Oh, the middle mouse button does show up now :). Thanks! So it is indeed recognized by MMA -- good news! And there is the bad news: this button's name is just "3" as in the output, which I guess means only that the third mouse button is being pressed. But "3" in the code is definitely solely for the number key "3" on the keybord. $\endgroup$ – User18 Aug 26 '16 at 13:37
  • $\begingroup$ For me Dynamic[CurrentValue[{"MouseButtonTest", 3}], UpdateInterval -> 0.02] works well. However, using {"MouseClicked", 3} inside EventHandler doesn't work. Probably because of the window scroll thing. Didn't check if one can switch that mouse scroll thing off to get {"MouseClicked", 3} working. $\endgroup$ – Karsten 7. Aug 26 '16 at 15:47
  • $\begingroup$ The same here. So the name of this button is still unknown. $\endgroup$ – User18 Aug 27 '16 at 3:16

It can be detected but I'm not sure if this helps or not for setting custom shortcuts.

To see this evaluate SystemInformation[], select the Devices tab in the dynamic panel that appears and open the appropriate Controller Device > Wolfram Language Controls. You'll see a list of the axes and buttons known for the device and their current values.

The middle button on my mouse is "B3".

  • $\begingroup$ Strangely there is no "Controller Device" under SystemInformation[]'s "Devices" tab here. What I can find are these items: "Screen Information", "Graphics Subsystem: DirectX", "Graphics Subsystem: OpenGL", "Graphics Subsystem: OpenGL", "Graphics Subsystem: Mesa" $\endgroup$ – User18 Aug 26 '16 at 9:30
  • $\begingroup$ I'm using Mma 11.0, OS X 10.11.6. You seem to be on Windows so YMMV. $\endgroup$ – MikeLimaOscar Aug 26 '16 at 10:05
  • $\begingroup$ Oh yes I am using v 11.0 on Windows 7. Forgot to mention it. $\endgroup$ – User18 Aug 26 '16 at 11:44

Aside from SystemInformation[], one can get controller device information from ControllerInformation. Here is a shot of my laptop's devices with one of the panels open.


Mathematica graphics

The OP might consider including such an image in the question, since it appears from a comment that User18's setup behaves differently.

  • 1
    $\begingroup$ I have there 5 entries related to my mouse, each useless :) maybe it is OS/drivers dependent. $\endgroup$ – Kuba Aug 26 '16 at 10:57
  • $\begingroup$ @Kuba All I have to test are Macs. There's ControllerInformation[All], which gives the information as sets of rules. It's much, much too long for me to read through. The panel above picks out only some of it, maybe only the active controls. $\endgroup$ – Michael E2 Aug 26 '16 at 11:05
  • $\begingroup$ Neither SystemInformation[] nor ControllerInformation[] works when the operating system is Windows 7. I'll add a screenshot in an answer below, since I feel that the extra image, being far larger than an icon, would make my question look too big. $\endgroup$ – User18 Aug 26 '16 at 12:52
  • $\begingroup$ @User18 You can use <img...> in the editor to control the size of the image. Folks who want to see the full size image can click on it. See this post on Meta. $\endgroup$ – Michael E2 Aug 26 '16 at 13:00
  • $\begingroup$ Ah, thanks for the advice. There are already responses to that reply, but let me study the link. $\endgroup$ – User18 Aug 26 '16 at 13:15

On Windows 7, neither SystemInformation[] nor ControllerInformation[] shows the mouse buttons.

enter image description here

  • $\begingroup$ So I guess there is an answer for Macs, but not yet for Windows, and who knows for Linux.... $\endgroup$ – Michael E2 Aug 26 '16 at 13:02

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.