B4A Library MeterView

A wrap for this Github project

Copy the attached library files to your additional library folder.
Sample B4A project attached

1.gif


Library:
MeterView
Author:
Github: George Kravas, Wrapped by: Johan Schoeman
Version: 1
  • MeterView
    Fields:
    • ba As BA
    Methods:
    • BringToFront
    • DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
    • Initialize (EventName As String)
    • Invalidate
    • Invalidate2 (arg0 As Rect)
    • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • IsInitialized As Boolean
    • RemoveView
    • RequestFocus As Boolean
    • SendToBack
    • SetBackgroundImage (arg0 As Bitmap)
    • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
    • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
    • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    Properties:
    • Background As Drawable
    • Color As Int [write only]
    • Enabled As Boolean
    • FaceColor As Int [write only]
    • Height As Int
    • Left As Int
    • MaximumValue As Float [write only]
    • MinimumValue As Float [write only]
    • Parent As Object [read only]
    • RimColor As Int [write only]
    • ScaleColor As Int [write only]
    • Tag As Object
    • Top As Int
    • Value As Float [write only]
    • ValueColor As Int [write only]
    • Visible As Boolean
    • Width As Int

Sample Code:
B4X:
#Region  Project Attributes
    #ApplicationLabel: b4aMeterView
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: portrait
    #CanInstallToExternalStorage: False
#End Region


#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
 
    Dim t As Timer

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Private mv1 As MeterView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("main")
 
    t.Initialize("t", 1000)
 
    mv1.MinimumValue = 0.0
    mv1.MaximumValue = 120.0
    mv1.RimColor = Colors.Green
    mv1.FaceColor = Colors.Red
    mv1.ScaleColor = Colors.White
 
End Sub

Sub Activity_Resume
 
    t.Enabled = True

End Sub

Sub Activity_Pause (UserClosed As Boolean)
 
    t.Enabled = False

End Sub

Sub t_tick
 
    Dim val As Int
    val = Rnd(0, 121)
    Dim d As Float = val
    mv1.Value = d
 
 
End Sub
 

Attachments

  • b4aMeterView.zip
    7.8 KB · Views: 213
  • MeterView_V1_00.zip
    11.8 KB · Views: 210
Top