aaronk Well-Known Member Licensed User Longtime User Feb 27, 2016 #1 Hi, I am using the iCircularProgress in my B4i App. The value of the progress in this library is set by a float number. I need to set the MAX value of the iCirclarProgress to be 1134. I have created a integer in Process_Globals and I am wanting to set the iCirclarProgress value based on that number. So far I have created a sub that will work out the percentage: Code: Sub GetPercent(value As String) As Float Return NumberFormat(value / 1135 * 100,3,3) End Sub I am setting the 'value' of this sub from the integer in the Process_Globals. So, the GetPercent for 576 should return 50 for 50%. Code: Log(GetPercent(576)) 'should log 50 How can I convert this value to be the value of the iCirclarProgress ? (Need a way to convert a integer to a float number)
Hi, I am using the iCircularProgress in my B4i App. The value of the progress in this library is set by a float number. I need to set the MAX value of the iCirclarProgress to be 1134. I have created a integer in Process_Globals and I am wanting to set the iCirclarProgress value based on that number. So far I have created a sub that will work out the percentage: Code: Sub GetPercent(value As String) As Float Return NumberFormat(value / 1135 * 100,3,3) End Sub I am setting the 'value' of this sub from the integer in the Process_Globals. So, the GetPercent for 576 should return 50 for 50%. Code: Log(GetPercent(576)) 'should log 50 How can I convert this value to be the value of the iCirclarProgress ? (Need a way to convert a integer to a float number)
S strat Active Member Licensed User Longtime User Feb 27, 2016 #2 You set value as String in the GetPercent sub. You can change it as value as int. Code: Sub GetPercent(value As int) As Float Upvote 0
You set value as String in the GetPercent sub. You can change it as value as int. Code: Sub GetPercent(value As int) As Float
JanPRO Well-Known Member Licensed User Longtime User Feb 27, 2016 #3 Hi, aaronk said: How can I convert this value to be the value of the iCirclarProgress ? Click to expand... you don't have to multiple by 100: Code: Log(GetValue(567.5)) 'returns 0.5 Sub GetValue(Val As Float) As Float Return (Val / 1135) End Sub Jan Upvote 0
Hi, aaronk said: How can I convert this value to be the value of the iCirclarProgress ? Click to expand... you don't have to multiple by 100: Code: Log(GetValue(567.5)) 'returns 0.5 Sub GetValue(Val As Float) As Float Return (Val / 1135) End Sub Jan
aaronk Well-Known Member Licensed User Longtime User Feb 27, 2016 #4 JanPRO said: Hi, you don't have to multiple by 100: Code: Log(GetValue(567.5)) 'returns 0.5 Sub GetValue(Val As Float) As Float Return (Val / 1135) End Sub Jan Click to expand... Thanks for your help with this.. When I run my code 48 times (such as add 1 to my int) and update the progress it shows it at 100%. For Example: If I run the following approx 48 times it shows the progress as 100%. Code: Sub RunMe() AddedItems = AddedItems + 1 iProgressBar.AddProgress(GetValue(AddedItems),0) End Sub Sub GetValue(Val As Float) As Float Return (Val / 1135) End Sub I would of thought I would need to run it 1135 times before it hits 100%. Am I doing it correctly ? Upvote 0
JanPRO said: Hi, you don't have to multiple by 100: Code: Log(GetValue(567.5)) 'returns 0.5 Sub GetValue(Val As Float) As Float Return (Val / 1135) End Sub Jan Click to expand... Thanks for your help with this.. When I run my code 48 times (such as add 1 to my int) and update the progress it shows it at 100%. For Example: If I run the following approx 48 times it shows the progress as 100%. Code: Sub RunMe() AddedItems = AddedItems + 1 iProgressBar.AddProgress(GetValue(AddedItems),0) End Sub Sub GetValue(Val As Float) As Float Return (Val / 1135) End Sub I would of thought I would need to run it 1135 times before it hits 100%. Am I doing it correctly ?
JanPRO Well-Known Member Licensed User Longtime User Feb 27, 2016 #5 Hi, aaronk said: Am I doing it correctly ? Click to expand... No, you are using AddProgress, so the Progress will be added. It's very simple: Code: Sub RunMe() 'When you call this sub 1135 times iCircularProgress shows 100% iProgressBar.AddProgress(GetValue(1),0) End Sub Sub GetValue(Val As Int) As Float Return (Val / 1135) End Sub Upvote 0
Hi, aaronk said: Am I doing it correctly ? Click to expand... No, you are using AddProgress, so the Progress will be added. It's very simple: Code: Sub RunMe() 'When you call this sub 1135 times iCircularProgress shows 100% iProgressBar.AddProgress(GetValue(1),0) End Sub Sub GetValue(Val As Int) As Float Return (Val / 1135) End Sub
aaronk Well-Known Member Licensed User Longtime User Feb 27, 2016 #6 JanPRO said: Hi, No, you are using AddProgress, so the Progress will be added. It's very simple: Code: Sub RunMe() 'When you call this sub 1135 times iCircularProgress shows 100% iProgressBar.AddProgress(GetValue(1),0) End Sub Sub GetValue(Val As Int) As Float Return (Val / 1135) End Sub Click to expand... Perfect, that fixed it. Thanks heaps for your help. Good job on the library as well. Upvote 0
JanPRO said: Hi, No, you are using AddProgress, so the Progress will be added. It's very simple: Code: Sub RunMe() 'When you call this sub 1135 times iCircularProgress shows 100% iProgressBar.AddProgress(GetValue(1),0) End Sub Sub GetValue(Val As Int) As Float Return (Val / 1135) End Sub Click to expand... Perfect, that fixed it. Thanks heaps for your help. Good job on the library as well.