Does system have a mouse attached?

I find the trackpad on OSX to behave badly, relative to the mouse wheel. That is, programming that works fine with a mouse wheel does strange things if using the built-in trackpad.

So I want to disable mouse wheel features when there is no wheel mouse attached. But I don’t see a way to do this in the Xojo docs.

Does anyone know how? I imagine an OSX system call? What about Windows?

Thx

You mean you’d like to disable the “wheel” (gesture) fir the trackpad when there’s a mouse plugged in?
You’d have to send a message to the trackpad’s driver, but that’s not something easily made with Xojo.
Additionally, it’s far more easy to think yourself “I have plugged a mouse, so don’t touch the trackpad” than dealing with/modifying a driver.

Usually, under Mac OS, every system-wide functions are handled by the OS anyway (using System Preferences).

Re your question, no. I want to disable the Wheel event when there is not a wheel mouse plugged in.

Because the OSX trackpad behaviour is not mapped to the wheel mouse behaviour in a way that is workable. It does something, but what it does it is not useful.

Maybe your trackpad is defective? Can you describe what is wrong? I use the trackpad all the time.

And are you looking to do this for your machine, or generically for all users of your app regardless of their OS settings?

For personal use, I highly recommend Better Touch Tool or similar software. Lets you configure all kinds of things that enhance trackpad, mouse, and keyboard behaviors.

It’s absolutely useful, just different. When a trackpad or magic mouse is connected, you should switch from scrolling a number of lines to a number of pixels. Everything makes a ton more sense this way. And, if theories are correct, future Macs will have touch screens that I’m certain will fire the events in the same way. If you’re somebody like me that never has an old-fashioned wheel attached to their Mac, I’d essentially never be able to scroll in your program and I’d hate it.

Don’t fight it. Learn how to make sense of it. Here’s a class that will do it: https://github.com/thommcgrath/ArtisanKit/blob/master/Project/ArtisanKit/ScrollEvent.xojo_code

In your MouseWheel event, call something like:

Var WheelData As New ArtisanKit.ScrollEvent(LineHeight, DeltaX, DeltaY)

With LineHeight set to the height of your lines so the code can adapt correctly for old-fashioned devices. Then use WheelData.ScrollX and WheelData.ScrollY to get back a number of pixels that should be scrolled.

If you absolutely cannot be convinced to do the right thing here, [NSEvent hasPreciseScrollingDeltas] will tell you wether the scroll event came from a device with precise scrolling like a trackpad, or line scrolling like a wheel. The linked class uses it, so that’s where you’d find the code. It still has to be called from within the MouseWheel event though.

Thanks Thom. I believe you nailed it.

I certainly want to do the right thing! :slight_smile: