B4A Library [B4X] SD ClockRange

I wanted to create a view that would help me for a Timer. (MinRange - MaxRange)
It could be for minutes or hours and then an editable Range. Furthermore, the user had to be able to choose where to start and where to end (MinValue - MaxValue)
The timer when it started had to show how far it had gone (MinLevel-Max_Level)
Here is the result

NOTE: You can use this library for personal and commercial use. Include it in your projects.. Attention, even if it is a B4XLib library, it is not allowed to decompress it, modify it, change its name or redistribute it without the permission of the author

SD_ClockRange

Author:
Star-Dust
Version: 0.04
  • SD_ClockRange
    • Events:
      • ChangeValue (MinValue As Int, MaxValue As Int)
    • Fields:
      • mBase As B4XView
      • Tag As Object
    • Functions:
      • BringToFront
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map)
        Base type must be Object
      • GetBase As B4XView
      • Initialize (Callback As Object, EventName As String)
      • RemoveViewFromParent
      • RequestFocus
      • SendToBack
      • Snapshot As B4XView
      • StartPoint (Degree As Int)
        Degree=90 UP; 135 Left; 180 Down; 215 Right;
        Degree=112 UP-Left; 202 Down-Left; 67 Up-Right; 237 Down-Rigt
    • Properties:
      • BallSize As Int
      • ColorBase As Int
      • ColorLevel As Int
      • ColorStick As Int
      • Enable As Boolean
      • Height As Int
      • Left As Int
      • LevelVisible As Boolean
      • MaxLevel As Float
      • MaxRange As Float
      • MaxValue As Int
      • MinLevel As Float
      • MinRange As Float
      • MinValue As Int
      • SizeFont As Int
      • StickSize As Int
      • TextColor As Int
      • Top As Int
      • Visible As Boolean
      • Width As Int


  • 0.01
    • Possibility to select an arc range between two numerical digits. Minimum and maximum range limit is set by design or code
    • Possibility of having a colored arc independent of the selected limits (Leve)
  • 0.02
    • Added the possibility to insert a colored arc along the selected area
  • 0.03
    • Added properties StickSize and BallSize. They allow you to determine the size / thickness of the selection spheres and the circular bar

1.gif
2.gif
 

Attachments

  • SD_ClockRange.b4xlib
    2.9 KB · Views: 67
Last edited:

Star-Dust

Expert
Licensed User
Sample 1

1644324891972.png
.
1.gif


B4X:
Private Sub Button1_Click
    SD_ClockRange1.LevelVisible=True
   
    SD_ClockRange1.MinLevel=SD_ClockRange1.MinValue
    For i=SD_ClockRange1.MinValue To SD_ClockRange1.MaxValue
        SD_ClockRange1.MAXLevel=i
        Sleep(1000)
    Next
End Sub
 

Attachments

  • Sample1.zip
    10.6 KB · Views: 66
Last edited:

Star-Dust

Expert
Licensed User
Example 2.
Create a timer that activates based on how the ClockRange is set

B4X:
Sub MainSub
    
    ' Divide for 60 minutes
    SD_ClockRange1.MaxRange=0
    SD_ClockRange1.MaxRange=59
    
    ' Select target clock from 55min to 05min
    SD_ClockRange1.MinValue=55
    SD_ClockRange1.MaxValue=5
    
    Tim.Initialize("Tim",1000)
    Tim.Enabled=True
End Sub

Private Sub Tim_Tick
    Dim M As Int = DateTime.GetMinute(DateTime.Now)
    
    If M>=SD_ClockRange1.MinValue And M<=SD_ClockRange1.MaxValue Then
        SD_ClockRange1.LevelVisible=True
        SD_ClockRange1.MinLevel=SD_ClockRange1.MinValue
        SD_ClockRange1.MaxLevel=SD_ClockRange1.MaxValue
    Else
        SD_ClockRange1.LevelVisible=False
    End If
End Sub
 

Attachments

  • Sample2.zip
    11.8 KB · Views: 67
Top