Automatic Pinwheel Cursor

I have noticed that since I upgraded from my quite old version of RB to Xojo, when my app does something that keeps it “busy” for a while (just a few seconds, really), the cursor automatically changes to the annoying “pinwheel” cursor. Is there any way at all to prevent this?

I am already changing the cursor to the plain old “watch” cursor (app.mouseCursor = system.cursors.wait) at the beginning of the lengthy operation. But then, partway through the operation, it suddenly switches from the watch to the pinwheel–which I find very undesirable!

The system automatically does that… You might want to look at your code to see what is taking so long and you might want to move it to a thread to stop the cursor change…

Try the “new” profiling feature in Xojo to find out where your App is doing all the hard work. :slight_smile:

[quote=196984:@Dave Jacobi]I have noticed that since I upgraded from my quite old version of RB to Xojo, when my app does something that keeps it “busy” for a while (just a few seconds, really), the cursor automatically changes to the annoying “pinwheel” cursor. Is there any way at all to prevent this?

I am already changing the cursor to the plain old “watch” cursor (app.mouseCursor = system.cursors.wait) at the beginning of the lengthy operation. But then, partway through the operation, it suddenly switches from the watch to the pinwheel–which I find very undesirable![/quote]
You may be using too long of a loop in your program. That is very often what triggers the beachball. The solution is to do the same thing in a timer.

Thanks for the replies. The “lengthy operation” is actually supposed to be “lengthy”–it’s an animation effect (showing pieces moving around on a game board). And I know I could do it with a timer instead of a loop (or maybe even use a thread–though I’ve never actually done that), but I don’t want the user to be able to do anything else while the animation is happening.

As I mentioned, my own code changes the cursor to the “watch” while the animation is happening, to signal to the user that the app is “busy.” But it’s very annoying that, for animations that last longer than 2 seconds, the cursor now suddenly changes from “watch” to “pinwheel” after those first 2 seconds!

Also, this can’t be a totally automatic/unavoidable system behavior, because it doesn’t happen in the RB 2008 version of my app–only in the Xojo version…

Yes, this is 100% system controlled. Your only choice is to not use synchronous animations. Prevent user interaction in some other way.

To the system, while your animation is running, your app appears to have crashed. On Windows, this may even trigger the “app has stopped responding” dialog. In OS X’s Force Quit dialog, your app would be listed as not responding. To the system, it can’t know that the process will end, it sees what could be an infinite loop.

If it helps, you can use my Animation Kit classes to power your animations, but I believe the hurdle is not the “how” of the problem, but the “why.” https://github.com/thommcgrath/AnimationKit

[quote=197175:@Dave Jacobi]Thanks for the replies. The “lengthy operation” is actually supposed to be “lengthy”–it’s an animation effect (showing pieces moving around on a game board). And I know I could do it with a timer instead of a loop (or maybe even use a thread–though I’ve never actually done that), but I don’t want the user to be able to do anything else while the animation is happening.
…/…
Also, this can’t be a totally automatic/unavoidable system behavior, because it doesn’t happen in the RB 2008 version of my app–only in the Xojo version…[/quote]

Two solutions : update your software to run with the latest version of the system in ways recommended by Apple to avoid the beachball (timer), or continue using RB 2008.

Just a detail. Would it be possible that the build in RB 2008 would have been Carbon, and the one where the beachball manifests today in be Cocoa ?

Cocoa is a lot more picky about code that freezes the app. It may explain.

Yes, that’s very possible. In fact, I’m pretty sure it’s the case.

Hmph. Well, obviously I either have to massively revise my approach to the animation in my app; be content with the pinwheel; or stick with RB 2008 despite all the money I paid to upgrade to Xojo. Not loving any of these options, but I guess it is what it is…

I think you already know what the “right” answer is. Switching to asynchronous animation may be the most work, but you’ll feel the best about it and your application will stay supported for longer. Because for all you know, a future OS X may require 64-bit apps, and you’ll be forced to upgrade anyway. Might as well do it on your terms.

You’re not wrong. I was just so close to being finished with this app, before I upgraded…!

Yeah, I can imagine that stings.