Progress wheel stops turning

I have an application where a thread is started to do a lengthy calculation. At the same time a progress wheel is made visible in the window to indicate that something is happening. And, when the thread ends, the progress wheel is made invisible again. So far, so good.

Now, I’ve just noticed that, if while the thread is running, I minimize the window and then bring it back again, the progress wheel has stopped turning. Everything else is working as normal. Is this a bug, or is there some event that I need to handle when the window is un-minimized.

This is on Mac OSX Yosemite, Xojo 2016r3.

I would think it should still be animating.

However, in Cocoa, spinning progress indicators aren’t always animated.
Out of curiosity, see if you can get it started again with the declare to animate. startAnimation:

I’ve managed to avoid declares for much of my Xojo programming career. Not sure how I would go about this.

I verified the bug.

The solution I found is to make the ProgressWheel a control set, so after the window is restored, you can create a new ProgressWheel, which will rotate normally, and make the previous one invisible.

In my test I create only one new progressWheel, but the process could be repeated as often as needed, by keeping count of the previous wheels.

I have attached the project to this bug report :

46028 - ProgressWheel gets frozen after the window has been minimized and restored
Status: Needs Review Rank: Not Ranked Product: Xojo Category: N/A

Michel Bujardet Today at 9:36 AM
OS: OS X 10.12.2

Xojo: Xojo 2016r3

Steps: See https://forum.xojo.com/36747-progress-wheel-stops-turning/0#p300334

See the attached project.

  • Launch the project
  • Minimize the window
  • Restore it : the progressWheel is frozen
    File attached: FrozzenProgressWheel.xojo_binary_project.zip

feedback://showreport?report_id=46028

Thanks for verifying that.
I think I’ve found a simpler workaround. I’ve added a restore event handler to the window and have put this code into it:

'Toggle visibility on window restore
  ProgressWheel1.Visible = not ProgressWheel1.Visible
  ProgressWheel1.Visible = not ProgressWheel1.Visible

In case you’d like to try the declare, it should be something like (untested):

Declare Sub startAnimation Lib "Appkit.framework" Selector "startAnimation:" (id as integer, sender as ptr)
and then to start

startAnimation yourProgresswheel.handle, nil

[quote=300445:@Robert Weaver]Thanks for verifying that.
I think I’ve found a simpler workaround. I’ve added a restore event handler to the window and have put this code into it:

'Toggle visibility on window restore ProgressWheel1.Visible = not ProgressWheel1.Visible ProgressWheel1.Visible = not ProgressWheel1.Visible [/quote]

Indeed it works just fine.

Fun fact, the declare works. (Awesome job for untested code, Ulrich!)
Even more fun fact, this is an OS level bug. I just tested it in Xcode.

Thanks. I guess the workaround will have to do then. It’s simple enough anyway, so it’s not a problem.