iOS Question how it works ProgressView in B4i

gudino jose luis

Active Member
Licensed User
Longtime User
hiI could not run Progressview in B4i

This is my code:

Sub BarraProgress1(Progress As Long, Total As Long)
ProgressView1.Initialize()
ProgressView1.Progress = Progress/Total

End Sub

note: Progress=50
Total= 100
 

gudino jose luis

Active Member
Licensed User
Longtime User
hi,
Thank you for your prompt response.

This is new code.
but the bar is still not updating

1) Add your views with the designer

BarraProgress1(50,100)

Sub BarraProgress1(Progress As Long, Total As Long)

ProgressView1.Progress = Progress/Total

End Sub
 
Upvote 0

PierPaduan

Active Member
Licensed User
Longtime User
Hi,
I've tested the example, but the progressview doesn't show the progress if it's updated in a For Next cycle. See attached code. It updates only at the end of the cycle.

B4X:
For i = 0 To 1000
   ProgressView1.Progress = ProgressView1.Progress + 1/1000
   Log(ProgressView1.Progress)
Next

Someone can help me? What I'm doing wrong?
Thanks a Lot.
 
Upvote 0

PierPaduan

Active Member
Licensed User
Longtime User
Thanks Erel.

So the way is:
- to break the big For Next cycle into some small cyles,
- start everyone using a timer,
- update the progressview at the end of every cycle.

Correct?
 
Upvote 0

PierPaduan

Active Member
Licensed User
Longtime User
I'm doing a pdf file in the following way.
There are many diameter and thickness. The pdf may have about 600 lines and the creation takes about 20 seconds in release mode.
The Progressview update only at the end of sub Calc.

B4X:
Sub Calc
   Unit = "a"
   For diameter = 1 to ....
      Cycle2
   Next

   Unit = "b"
   For diameter = 1 to ....
      Cycle2
   Next

   Unit = "c"
   For diameter = 1 to ....
      Cycle2
   Next
End Sub

Sub Cycle2
   For Thickness = 1 to ....
      CalcParameters
   Next
End Sub

Sub CalcParameters
   ' here the parameters are calculated
   ' according diameter and thickness
   ' and written in the pdf file in a new line
   ' of a table.
End Sub
 
Upvote 0

PierPaduan

Active Member
Licensed User
Longtime User
Hi, Thank
Do you mean to do so? :

B4X:
'Cycle2
CallSubDelayed(Me, Cycle2)

Because this doesn't work, the progressview doesn't update in release nor in debug mode.
But if I put a breakpoint on the line where the progressview is increased, I can see the progressview increasing after every break.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…