Detect Scroll Wheel Press?

Is it possible to detect the depression of a mouse’s scroll wheel.

If so, could someone please point me in the right direction.

Thank you all in advance.

Rather like the right mouse button, what happens for the scroll wheel on OSX depends upon how the driver ‘maps’ the click.
Right mouse button maps to CTRL-click (IsContextual)
What happens on a user’s machine is unknown to you, as far as I can tell.

I have code for Windows somewhere, however…

This is only for my own personal use, so do you know how I find out what the scroll wheel maps to?
I’m trying to make my app shrink to the dock when the mouse scroll wheel is depressed, and then reappear when pressed again.

I therefore need the mouse’s scroll wheel to act a a toggle button.


What happens if you put the cursor into a textedit window, and press it?
If nothing, then it may not be mapped to do anything.

I think you need to install 3rd party software like SmartScroll, USB Overdrive,Magic Prefs or similar might help.

I have a non-apple mouse, and have BetterTouchTool installed, but have no idea how to make the scroll wheel depression act as a toggle in Xojo.


I dont have BTT but…

Looks like you select the scroll button, select Advanced click, and tell BTT that when this button is clicked ‘pretend’ the CMD, Shift, Option, or CTRL button is also pressed.
If you do that, you can check the status of these keys using keyboard.async??? in the mousedown event.

Hmm, I may have to rethink this, as shortcuts are not recognised by my app when it’s minimized.
Thanks for the help anyway.

Why do you want that very unusual command in macOS anyway ?

Not sure what you mean Michel?
For convenience sake, I want to quickly press the middle mouse button to show a window of my app, then simply press it again to hide it. For me this is much quicker than any other options :slight_smile:

Well, here :

Google search is your friend.

Thanks Michel. I already looked at that post, but it made no sense to me, and I have no idea what that project file is supposed to do?
Thanks anyway :slight_smile:


Together with this solution is inside.

Personal efforts required…

Some ambitions sometimes require more than waiting for others to do all the work.

I never asked anyone to do all the work - I simply said I didn’t understand the example you pointed to !!!
So sorry I’m not as fantastic as you!