Android Question How to get B4XProgressBar width?

App Dude

Active Member
Licensed User
Longtime User
On a B4XPage, I want to put text at the far right edge of a B4XProgressBar, so I need to get the progress bar's width (and left position). But it does not have parameters/values for these. How would I go about getting these? (I'm doing this in my B4XPage class, under B4XPage_Created sub.
In this pic, pbEff is dimmed as B4XProgressBar:

1635523522550.png
 

App Dude

Active Member
Licensed User
Longtime User
I need to do this, but to maximize the progress bar's width, I want the right side of the "125%" to be flush with the right side of the progress bar. I need to calculate it so that it can adjust for different phone screens.

1635529293880.png
 
Upvote 0

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
You could do it like this.

Needs a bit of a tidy but will work.

The script will automatically adjust to screen size.

edit: I used panels for the tick marks, but there are probably better ways to do this.


1635530556029.png

edit:
 
Upvote 0

App Dude

Active Member
Licensed User
Longtime User
Andrew, yes, that's exactly what I was planning to do, but I'm using B4XProgressBar, and it won't let me read the width... there's no ".Width" for it.
I've somewhat worked around it for now... in the B4XProgressBar create method, I can read the width at mBase.Width, and I'm saving that in a global variable, which I can use later.
 
Upvote 0
Top