# What is the middle mouse button called in Mathematica's code?

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)?

• In fact there were reports indicating that the middle mouse button was perhaps not recognized by Mathematica. mathematica.stackexchange.com/questions/113261/… – User18 Aug 26 '16 at 9:45
• This might be helpful: Dynamic[CurrentValue["MouseButtons"], UpdateInterval -> 0.02]. Clicking somewhere outside the front end window works best. – Karsten 7. Aug 26 '16 at 13:23
• @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. – User18 Aug 26 '16 at 13:37
• 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. – Karsten 7. Aug 26 '16 at 15:47
• The same here. So the name of this button is still unknown. – 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".

• 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" – User18 Aug 26 '16 at 9:30
• I'm using Mma 11.0, OS X 10.11.6. You seem to be on Windows so YMMV. – MikeLimaOscar Aug 26 '16 at 10:05
• Oh yes I am using v 11.0 on Windows 7. Forgot to mention it. – 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.

ControllerInformation[]


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

• I have there 5 entries related to my mouse, each useless :) maybe it is OS/drivers dependent. – Kuba Aug 26 '16 at 10:57
• @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. – Michael E2 Aug 26 '16 at 11:05
• 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. – User18 Aug 26 '16 at 12:52
• @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. – Michael E2 Aug 26 '16 at 13:00
• Ah, thanks for the advice. There are already responses to that reply, but let me study the link. – User18 Aug 26 '16 at 13:15

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

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