B4A Library ProtractorView

It comes from here. Sure you will figure out what to do and to add whatever else you would like to add.

1.gif


1. Extract LibRes and the copy it (including its contents) the be on the same folder level as that of the /Files and /Objects folders of the B4A project
2. Posting the B4A library files - extract them and copy them to your additional library folder
3. Posting the Java Code - change it to your liking
4. Posting the B4A sample project.

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

#AdditionalRes: ..\LibRes

#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.

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 pv1 As ProtractorView
    Private Label1 As Label
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")
   
    pv1.AngleTextSize = 25            
    pv1.ArcProgressWidth = 15
    pv1.ArcWidth = 10
    pv1.ArcColor = Colors.Yellow
    pv1.ProgressColor = Colors.Green
    pv1.TickIntervals = 15
    pv1.Angle = 135
    pv1.TickLength = 15                 'the length of the ticks
    pv1.TickOffset = 25                 'how close are the ticks to the arc

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub pv1_angle_changed(angle As Double)
    Label1.TextColor = Colors.White
    Label1.TextSize = 16
    Label1.Text = "" & angle
   
End Sub
 

Attachments

  • LibRes.zip
    3.9 KB · Views: 332
  • b4aProtractorView.zip
    8.2 KB · Views: 314
  • ProtractorViewLibFiles.zip
    14.9 KB · Views: 317
  • TheJavaCode.zip
    43.5 KB · Views: 315
Top