Monday, April 24, 2017

#1 2016-08-19 08:49:35 am

Jonathan Engelhardt
Member
Registered: 2010-06-11
Posts: 57

NSProgressIndicator Smooth animation

Hi there,

i have an NSProgressIndicator as bar correctly displayed, initiated and it also increments well.
The problem i have is that is just "jumps" to the next step instead of smoothly filling up.

I also tried to put the stuff inside a new NSThread (but as its ASOC anyways i think it all goes through Applescript Object anyways)

Heres my Code (reduced to what's necessary)

Applescript:


property processBarMainWindowSmall: missing value

set currentProgressIndicator to processBarMainWindowSmall -- needed because i have several indicators to handle
set currentProgressIndicator's indeterminate to true
currentProgressIndicator's startAnimation_(missing value) -- Starts the animation of an indeterminate progress indicator.
set currentProgressIndicator's maxValue to 5
currentProgressIndicator's setUsesThreadedAnimation:true

add()
delay 1
add()
delay 1
add()

on add()
set currentProgressIndicator to processBarMainWindowSmall
set currentProgressIndicator's indeterminate to false
currentProgressIndicator's incrementBy:1
end

Last edited by Jonathan Engelhardt (2016-08-19 08:54:18 am)

Offline

 

#2 2016-08-19 11:47:56 am

Mark FX
Member
From: UK
Registered: 2011-08-12
Posts: 94

Re: NSProgressIndicator Smooth animation

Hi Jonathan

I'm a bit confused with your posting.
Firstly an indeterminate progress indicator doesn't use the maxValue: or a incrementBy: methods.
These particular methods are used by a determinate progress indicator, and not the indeterminate type.
Maybe you've made a mistake in the definition of your posting by accident, but it's worth clarifying this in order to get some help from other users.

Secondly you seem to be mixing AppleScriptObc syntax styles in your code, with the older method_(param) and the interleaved method:(param) styles.
So it may also be worth clarifying what version of OSX and Xcode your using.

I used two progress indicators myself in a recent project, and found setting the parameters of the progress bar before starting it's animation works fine, so use the  setUsesThreadedAnimation:true method before starting the animation.
I'm not sure it makes much difference in an ASOC project, but it does seem more logical to me.

Lastly if you where referring to a determinate progress indicator, then a maxValue of only 5 would make it appear to jump in large steps, as the visual length of the progress bar would be divided into five segments, and each fifth of the bar would fill with each increment, which would account for what you describe.

Regards Mark

Last edited by Mark FX (2016-08-19 11:50:43 am)

Offline

 

#3 2016-08-19 12:09:09 pm

Jonathan Engelhardt
Member
Registered: 2010-06-11
Posts: 57

Re: NSProgressIndicator Smooth animation

Intermediate state is deactivated in add () function.
Works perfect. All I want is smoother animation from step to step as I know it is possible.
There is no need to split the process in 1000s of steps to get a "fake" smooth animation.

Newest Xcode 7 (not beta). Osx 10.11 (newest)

Is there a problem with mixing calls?
Let's not drift away from my issue...

Still looking for a way to smoothly move progress bar from step 1 to step 2.

Last edited by Jonathan Engelhardt (2016-08-19 03:22:35 pm)

Offline

 

#4 2016-08-19 04:00:44 pm

Mark FX
Member
From: UK
Registered: 2011-08-12
Posts: 94

Re: NSProgressIndicator Smooth animation

Your code is wrong.
Your approach is wrong.
And your attitude is wrong.

And I'm out.

Offline

 

#5 2016-08-20 12:23:40 am

Jonathan Engelhardt
Member
Registered: 2010-06-11
Posts: 57

Re: NSProgressIndicator Smooth animation

This is not very helpful.

The code works perfect so far. If there is something wrong you'd better help instead of flaming.
You can switch a progress indicator from indeterminate to determinate state - that's what i am doing here.

Anyone else... with more constructive comment?

EDIT: Found the solution myself by writing a category for NSProgressIndicator using NSAnimation
EDIT2: For anyone else who is interested - Somenone else had the same idea: https://github.com/eternalstorms/NSProg … orCategory

Last edited by Jonathan Engelhardt (2016-08-20 12:37:26 am)

Offline

 

Board footer

Powered by FluxBB

[ Generated in 0.054 seconds, 10 queries executed ]

RSS (new topics) RSS (active topics)