Android Question (Solved) No Text On Progress Bars

MrKim

Well-Known Member
Licensed User
Longtime User
I have tried both AnotherProgressBar and CircularProgressBar. For both of them Text IS displayed with B4i and B4J but NOT with B4A.
I have tested this with A pixel 3XL and a Lenovo tb-8504f. Code is below.
B4X:
CircularProgressBar1.Value = XXX
MP.ProgressBar.mBase.GetView(1).Text = XXX
 

MrKim

Well-Known Member
Licensed User
Longtime User
Sigh, once again it is me messing with your code/sort of.

After hours of messing around thinking it had to do with the fact that it was on top of an expandable CLV, or then maybe B4Xpages I finally figured it out. There was no visible property so I made mBase public and used that to make the view visible/invisible. This worked fine in B4J, which is where I try to do most of my dev., and it also works fine in B4i, but for some reason in B4A when you do this the text is no longer visible.

So what is the recommended procedure to make CircularProgressBar bar visible/invisible?

BTW AnotherProgressBar, I believe, has the same issue and it has mBase exposed by default. Perhaps it has to do with setting the default invisible in designer?

Thanks for your help.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
but for some reason in B4A when you do this the text is no longer visible.
Reading your post, it is not clear if you were able to solve the problem in B4A or not.
I have , like you, made mBase public in the class and was able to make it visible/invisible. The text is visible when mBase is visible and hidden when mBase is invisible. I did not have to change mLbl to show/hide the text. But if it is a problem on your device or whatever, you can make mLbl also public and it will be hidden/unhidden.
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
Reading your post, it is not clear if you were able to solve the problem in B4A or not.
I have , like you, made mBase public in the class and was able to make it visible/invisible. The text is visible when mBase is visible and hidden when mBase is invisible. I did not have to change mLbl to show/hide the text. But if it is a problem on your device or whatever, you can make mLbl also public and it will be hidden/unhidden.
Thank you, no I have not solved it. It is interesting it works for you. I find it does not work on multiple devices.

I have solved it! Evidently Android sets mLbl invisible if the view is invisible in designer? (I did not test this) in any case the solution is to add mLbl.Visible = True in DesignerCreateView of CircularProgressBar.

B4X:
Public Sub DesignerCreateView (Base As Object, Lbl As Label, Props As Map)
    mBase = Base
    mBase.SetLayoutAnimated(0, mBase.Left, mBase.Top,  Min(mBase.Width, mBase.Height), Min(mBase.Width, mBase.Height))
    clrFull = xui.PaintOrColorToColor(Props.Get("ColorFull"))
    clrEmpty = xui.PaintOrColorToColor(Props.Get("ColorEmpty"))
    stroke = DipToCurrent(Props.Get("StrokeWidth"))
    DurationFromZeroTo100 = Props.Get("Duration")
    mLbl = Lbl
    mLbl.Visible = True  'Added this line
    cx = mBase.Width / 2
    cy = mBase.Height / 2
    radius = cx - 10dip
    cvs.Initialize(mBase)
    mLbl.SetTextAlignment("CENTER", "CENTER")
    mBase.AddView(mLbl, 0, cy - 20dip, mBase.Width, 40dip)
    cvs.Initialize(mBase)
    DrawValue(currentValue)
End Sub
 
Last edited:
Upvote 0
Top