B4J Question [BANanoVueMaterial] ProgressCircular setValue and setText has no effect after initialisation

khng

Member
Licensed User
Longtime User
Hi @Mashiane ,

I noticed this after vm.CreateProgressCircular, What do i need to do ?

And, is there a way to change the circle's radius and stroke-width ?

Thanks.
 

khng

Member
Licensed User
Longtime User
Perhaps I didn't convey my message clearly.

with the following code
B4X:
    PC1 = vm.CreateProgressCircular("progresscircular1", Me)
    PC1.SetValue("90").SetText("90%").SetSize("90").SetColor(vm.COLOR_AMBER).SetTextColor(vm.COLOR_BLUE).SetWidth("20")

I get

1591893023627.png


Subsequently, I want to change text/value from 90% to 60%

B4X:
PC1.SetValue("60")
PC1.SetText("60%")

The text/value is intact.

Please advise. Thanks.
 
Upvote 0

Mashiane

Expert
Licensed User
Longtime User
I will be publishing Core 4.13 soon, here is your solution. In this example we run an update every 1 second using BANAno.SetInterval

1. Define the variable in process_globals

B4X:
Private pc5 As VMProgressCircular

2. Build the component. NB: Note that for .SetText we just pass the suffix '%'. Your .SetValue can just be '90' on your case, I have used '0' for my demo here.

B4X:
pc5.Initialize(vue, "pc5", Me).SetVisible(True).SetText("%").SetTextColor(vm.COLOR_BLUE)
    pc5.SetRotate("360").SetSize("90").SetWidth("20").SetColor(vm.COLOR_AMBER).SetValue("0")
    cont.AddControl(pc5.ProgressCircular, pc5.tostring, 6, 2, 0, 0, 0, 0, 12, 6, 6, 6)

3. We are running this every 1 second, lets define the callback... What we do here is check the value, when it reaches 100, we make it zero and start all over again.

B4X:
Sub startit
    Dim cb As BANanoObject = BANano.callback(Me,"circulate", Null)
    BANano.Window.SetInterval(cb, 1000)
End Sub

Sub circulate
    'read the stored value
    Dim vpc5 As String = pc5.GetValue
    Log(vpc5)
    vpc5 = BANano.parseint(vpc5)
    If vpc5 = "100" Then
        'we have reached 100%
        vpc5 = "0"
    Else
        'increment by 10
        vpc5 = BANano.parseint(vpc5) + 10
    End If
    'save the state
    pc5.SetValue(vpc5)
End Sub

4. This produces

BVMProgressCircular.gif


So on your case, just run something like this

B4X:
pc1.SetValue("60")

The update will be available here, in a couple of days..

PS: With the BVM Designer - the source code will be generated based on your options as depicted below.

progress circle.png


progresssourcecode.png
 

Attachments

  • progress circle.png
    progress circle.png
    59.1 KB · Views: 146
Last edited:
Upvote 0
Top