B4A Library [B4X] [XUI] AS NumberProgressBar

Hello,
i spend a lot of time in creating views, like this and to create a high quality view cost a lot of time. If you want to support me and further views, then you can do it here by Paypal. :)

Features
  • cross-platform compatible
  • Prefix and Suffix
  • customizable
  • Increment and Decrement Progress
  • easy to use
Bildschirmfoto 2020-05-17 um 01.05.09.png
ezgif.com-crop.gif


ASNumberProgressBar
Author: Alexander Stolte
Version: 1.00

  • ASNumberProgressBar
    • Functions:
      • Class_Globals As String
      • DecrementProgressBy (by As Int) As String
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map) As String
        Base type must be Object
      • getBarMax As Int
      • getCurrentProgress As Int
      • getPrefix As String
      • getReachedColor As Int
      • getReachedHeight As Float
      • getSuffix As String
      • getTextBackgroundColor As Int
      • getTextColor As Int
      • getTextFont As B4XFont
      • getTextOffset As Int
      • getUnreachedColor As Int
      • getUnreachedHeight As Float
      • IncrementProgressBy (by As Int) As String
      • Initialize (Callback As Object, EventName As String) As String
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • setBarMax (bar_max As Int) As String
      • setCurrentProgress (current_progress As Int) As String
      • setPrefix (prefix As String) As String
      • setReachedColor (color As Int) As String
      • setReachedHeight (height As Float) As String
      • setSuffix (suffix As String) As String
      • setTextBackgroundColor (color As Int) As String
      • setTextColor (color As Int) As String
      • setTextFont (fnt As B4XFont) As String
      • setTextOffset (offset As Int) As String
      • setUnreachedColor (color As Int) As String
      • setUnreachedHeight (height As Float) As String
    • Properties:
      • BarMax As Int
      • CurrentProgress As Int
      • Prefix As String
      • ReachedColor As Int
      • ReachedHeight As Float
      • Suffix As String
      • TextBackgroundColor As Int
      • TextColor As Int
      • TextFont As B4XFont
      • TextOffset As Int
      • UnreachedColor As Int
      • UnreachedHeight As Float
Changelog
  • 1.00
    • Release
  • 1.01
    • BugFixes
Have Fun :)
 

Attachments

  • B4A Example.zip
    3.7 KB · Views: 575
  • B4I Example.zip
    3 KB · Views: 399
  • B4J Example.zip
    2.5 KB · Views: 439
  • ASNumberProgressBar.b4xlib
    2 KB · Views: 107
Last edited:

Metalika

Member
hi @Alexander Stolte

thank you for share this awesome lib.

i want to change font :
B4X:
Sub Process_Globals
Private Xui As XUI
Private FontXui As B4XFont=Xui.CreateFont(Typeface.LoadFromAssets("my.ttf"),15)
end sub
.
.
.
V_ProgressBar.TextFont(FontXui)

BUT NOT WORK. And B4a give Me Error in syntax.

Wher is my Wrong?

Thank u.
 

Metalika

Member
hi how i can use this lib with code :(your example made in designer)
what is callback object ?
Initialize (Callback As Object, EventName As String) As String
i use this but it not work

Dim aa As Object
ASNumberProgressBar3.Initialize(aa,"ASNumberProgressBar3")
ASNumberProgressBar3.BarMax=100
ASNumberProgressBar3.CurrentProgress=50
Activity.AddView(aa,0,50%y,100%x,5%y)

@Alexander Stolte
 
Last edited:

73Challenger

Member
Licensed User
@Alexander Stolte - Thank you for the number progress bars. Donation sent via PayPal.
I had to write some significant code to customize them, but everything was in your library that I needed. They work great!
Sometime soon I'll post this in "Share your creations" and credit your work. Thanks again.

Color change to highlight "Hot, Neutral, Cold"
1634509932481.png
1634510003470.png
1634510071740.png


Scaling Change. As the count grows, I reset BarMax to keep the bars proportioned and within the view.
1634510511421.png
1634511112821.png
1634510563637.png


I only had one minor issue I haven't been able to resolve (circled in screenshot below). In some cases when I reset BarMax I get a small overlap. Not a big deal, it may be an issue with the way I increment BarMax, I'll try to figure it out someday.

1634510935014.png


Thanks again!
 

Attachments

  • 1634510060473.png
    1634510060473.png
    79 KB · Views: 181

james_sgp

Active Member
Licensed User
Longtime User
I`m getting an error trying to increment value, in B4i. The progress bar is in a card i`m displaying on a CLV (code below):


B4X:
Error occurred on line: 235 (ASNumberProgressBar)
Object was not initialized (B4IRect)
Stack Trace: (
  CoreFoundation       DD8145FF-7279-3C33-9B3F-0DA5541DD7F9 + 39472
  libobjc.A.dylib      objc_exception_throw + 56
  CoreFoundation       DD8145FF-7279-3C33-9B3F-0DA5541DD7F9 + 975676
  Gear Invent          -[B4IObjectWrapper object] + 120
  Gear Invent          -[B4XCanvas ClearRect:] + 32
  Gear Invent          -[b4i_asnumberprogressbar _progress::] + 1548
  CoreFoundation       DD8145FF-7279-3C33-9B3F-0DA5541DD7F9 + 458128
  CoreFoundation       DD8145FF-7279-3C33-9B3F-0DA5541DD7F9 + 128216
  Gear Invent          +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1400
  Gear Invent          -[B4IShell runMethod:] + 420
 Gear Invent          -[B4IShell raiseEventImpl:method:args::] + 1968
 Gear Invent          -[B4IShellBI raiseEvent:event:params:] + 1360
 Gear Invent          -[b4i_asnumberprogressbar _progress::] + 292
 Gear Invent          -[b4i_asnumberprogressbar _settextfont::] + 464

B4X:
Private Sub Createitem(id As String, usage As Int, repair As Int) As Panel
    Dim p As B4XView = xui.CreatePanel("")
    p.setlayoutanimated(0,0%x,0%y,100%x,5%y)
    p.LoadLayout("chart_card")
    tag_id.Text = id

    Log(usage & " - " & repair)
    usage_bar.TextFont = xui.CreateDefaultBoldFont(15)
    repair_bar.TextFont = xui.CreateDefaultBoldFont(15)
    
    If usage <> 0 Or usage <> Null Then
        usage_bar.incrementProgressBy(10)'usage)
    End If
    If repair <> 0 Or repair <> Null Then
        repair_bar.incrementProgressBy(20)'repair)
    End If
    
    Return p
End Sub
 

james_sgp

Active Member
Licensed User
Longtime User
I attached the code that I`m using to create the card on the CLV at the bottom of my post. As u an see i`ve even put values into the 'incrementprogressby'.
 

Alexander Stolte

Expert
Licensed User
Longtime User
I attached the code that I`m using to create the card on the CLV at the bottom of my post. As u an see i`ve even put values into the 'incrementprogressby'.
i tested it without clv and it works. If you want me to test it with clv, please provide a sample project. Thank you.
 

james_sgp

Active Member
Licensed User
Longtime User
Thanks, its all working fine of B4A...its just giving me trouble on B4i.

Sample program attached
 

Attachments

  • Project.zip
    176.9 KB · Views: 79

Alexander Stolte

Expert
Licensed User
Longtime User
Top