B4J Question [BANano] How to view progress in SKProgressBar

angel_

Well-Known Member
Licensed User
Longtime User
How can I see how the progress in SKProgressBar?.

I only display the full bar at the end of the process

B4X:
SKProgressBar1.Percentage = 0
....code 1
SKProgressBar1.Percentage = 20
....code 2
SKProgressBar1.Percentage = 40
...
SKProgressBar1.Percentage = 100
 
Solution
Maybe it just happens to fast? You could try putting a BANano.Sleep in it:

B4X:
Dim body As BANanoElement
body.Initialize("body")
body.LoadLayout("layout1")  ' just a layout with a SKProgressBar on it
    
SKProgressBar1.Percentage = 10
BANano.Sleep(50)
SKProgressBar1.Percentage = 20
BANano.Sleep(50)
SKProgressBar1.Percentage = 30
BANano.Sleep(50)
SKProgressBar1.Percentage = 40
BANano.Sleep(50)
SKProgressBar1.Percentage = 50
BANano.Sleep(50)
SKProgressBar1.Percentage = 60
BANano.Sleep(50)
SKProgressBar1.Percentage = 70
BANano.Sleep(50)
SKProgressBar1.Percentage = 80
BANano.Sleep(50)
SKProgressBar1.Percentage = 90
BANano.Sleep(50)
SKProgressBar1.Percentage = 100

I can clearly see it move.

Alwaysbusy

GMan

Well-Known Member
Licensed User
Longtime User
Try for....next
 
Upvote 0

Mashiane

Expert
Licensed User
Longtime User
How can I see how the progress in SKProgressBar?.

I only display the full bar at the end of the process

B4X:
SKProgressBar1.Percentage = 0
....code 1
SKProgressBar1.Percentage = 20
....code 2
SKProgressBar1.Percentage = 40
...
SKProgressBar1.Percentage = 100
Idea: Add a timer

B4X:
Dim timer1 As Timer
timer1.Initialize("timer1", 1000)
dim prg As Int = 0

Sub timer1_tick
prg = banano.parseInt(prg) + 10
skprogressBar1.Percentage = prg
End Sub

Normal B4j timer code - above might not be accurate to the point!
 
Upvote 0

angel_

Well-Known Member
Licensed User
Longtime User
Idea: Add a timer

B4X:
Dim timer1 As Timer
timer1.Initialize("timer1", 1000)
dim prg As Int = 0

Sub timer1_tick
prg = banano.parseInt(prg) + 10
skprogressBar1.Percentage = prg
End Sub

Normal B4j timer code - above might not be accurate to the point!
I can't get it to work with the timer function either
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
Maybe it just happens to fast? You could try putting a BANano.Sleep in it:

B4X:
Dim body As BANanoElement
body.Initialize("body")
body.LoadLayout("layout1")  ' just a layout with a SKProgressBar on it
    
SKProgressBar1.Percentage = 10
BANano.Sleep(50)
SKProgressBar1.Percentage = 20
BANano.Sleep(50)
SKProgressBar1.Percentage = 30
BANano.Sleep(50)
SKProgressBar1.Percentage = 40
BANano.Sleep(50)
SKProgressBar1.Percentage = 50
BANano.Sleep(50)
SKProgressBar1.Percentage = 60
BANano.Sleep(50)
SKProgressBar1.Percentage = 70
BANano.Sleep(50)
SKProgressBar1.Percentage = 80
BANano.Sleep(50)
SKProgressBar1.Percentage = 90
BANano.Sleep(50)
SKProgressBar1.Percentage = 100

I can clearly see it move.

Alwaysbusy
 
Upvote 0
Solution

angel_

Well-Known Member
Licensed User
Longtime User
You are right, it works correctly, the problem was that it was inside another sub and also inside a for loop, I took it out of the for and
I put the code inside the same sub
 
Upvote 0
Top