B4A Library [B4X] [XUI] AS Clock - Analog Clock or Digital

Thanks to @wonder for his nice "Analog Clock with Sound", this safes me a lot of time.

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 or with a coffee. :)

ezgif.com-gif-maker (3).gif
trBeD8fc5L9yJ8Ex7FsDDtsaLOpA1HudhHrte7jkTi5BaewbrV.jpeg
Rvbn4kBSqK5hAFxICoGNa9yn0ow5mJiixSomSo9izloB7XZIG3.jpeg
80yVTxzWDOlj76T66h1uygEqoFZNGWampT1vqDdAZG8ULy0TAM.jpeg
5zn5LHfWR8owb50YsSqoJpMvnIAJ1iUpCLpj4uIKYKaQDUb31e.jpeg
1648543175201.png

ASClock
Author: Alexander Stolte
Version: 1.01

  • ASClock
    • Fields:
      • mBase As B4XView
      • Tag As Object
    • Functions:
      • Class_Globals As String
      • CreateASClock_MiddleTextProperties (TextColor As Int, xFont As B4XFont) As ASClock_MiddleTextProperties
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map) As String
        Base type must be Object
      • Draw As String
      • getCornerColor As Int
      • getCornerWidth As Float
      • getInnerColor As Int
      • getMiddleText As String
      • getMiddleTextProperties As ASClock_MiddleTextProperties
      • getShowDialText As Boolean
      • getShowHourMark As Boolean
      • getShowMinutesMark As Boolean
      • Initialize (Callback As Object, EventName As String) As String
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • setCornerColor (Color As Int) As String
      • setCornerWidth (CornerWidth As Float) As String
      • setInnerColor (Color As Int) As String
      • setMiddleText (Text As String) As String
      • setShowDialText (Show As Boolean) As String
      • setShowHourMark (Show As Boolean) As String
      • setShowMinutesMark (Show As Boolean) As String
      • SetTime (Hour As Int, Mins As Int, Secs As Int) As String
    • Properties:
      • CornerColor As Int
      • CornerWidth As Float
      • InnerColor As Int
      • MiddleText As String
      • MiddleTextProperties As ASClock_MiddleTextProperties [read only]
      • ShowDialText As Boolean
      • ShowHourMark As Boolean
      • ShowMinutesMark As Boolean
  • ASClock_MiddleTextProperties
    • Fields:
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • TextColor As Int
      • xFont As B4XFont
    • Functions:
      • Initialize
        Initializes the fields to their default value.
Changelog
  • 1.00
    • Release
  • 1.01
    • Add get and set ScaleColor
    • Add get and set SweepHands
  • 1.02
    • Add Designer Property ClockMode - 12 and 24
      • Default: 12
      • If 24 then the clock displays 1-24
      • If 12 then the clock displays 1-12
  • 1.03 (read more)
    • Add SleepDuration to ClockMode
Have Fun :)
 

Attachments

  • AS Clock Example.zip
    10.5 KB · Views: 518
  • ASClock.b4xlib
    3.1 KB · Views: 53
Last edited:

JohnC

Expert
Licensed User
Longtime User
I wonder if this can be used with watches running Google Wear.
 

rgarnett1955

Active Member
Licensed User
Longtime User
Thanks to @wonder for his nice "Analog Clock with Sound", this safes me a lot of time.

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. :)

View attachment 124098View attachment 124099View attachment 124100View attachment 124101View attachment 124102
ASClock
Author: Alexander Stolte
Version: 1.00

  • ASClock
    • Fields:
      • mBase As B4XView
      • Tag As Object
    • Functions:
      • Class_Globals As String
      • CreateASClock_MiddleTextProperties (TextColor As Int, xFont As B4XFont) As ASClock_MiddleTextProperties
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map) As String
        Base type must be Object
      • Draw As String
      • getCornerColor As Int
      • getCornerWidth As Float
      • getInnerColor As Int
      • getMiddleText As String
      • getMiddleTextProperties As ASClock_MiddleTextProperties
      • getShowDialText As Boolean
      • getShowHourMark As Boolean
      • getShowMinutesMark As Boolean
      • Initialize (Callback As Object, EventName As String) As String
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • setCornerColor (Color As Int) As String
      • setCornerWidth (CornerWidth As Float) As String
      • setInnerColor (Color As Int) As String
      • setMiddleText (Text As String) As String
      • setShowDialText (Show As Boolean) As String
      • setShowHourMark (Show As Boolean) As String
      • setShowMinutesMark (Show As Boolean) As String
      • SetTime (Hour As Int, Mins As Int, Secs As Int) As String
    • Properties:
      • CornerColor As Int
      • CornerWidth As Float
      • InnerColor As Int
      • MiddleText As String
      • MiddleTextProperties As ASClock_MiddleTextProperties [read only]
      • ShowDialText As Boolean
      • ShowHourMark As Boolean
      • ShowMinutesMark As Boolean
  • ASClock_MiddleTextProperties
    • Fields:
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • TextColor As Int
      • xFont As B4XFont
    • Functions:
      • Initialize
        Initializes the fields to their default value.
Changelog
  • 1.00
    • Release
Have Fun :)
Hi,

I like your clock.

I added a couple of features:

1. Control the color of the scale indications. They were defaulted to white so you had to have a dark themed clock to see them
2. Created an option to "sweep" the hour and minute hands to remove ambiguity when the minute hand is near twelve.

I haven't provided programmable settings for these so they are only available through the designer.

If you like these mods you can update your code and maybe add in functions for programming these new properties.

Best regards
Rob
 

Attachments

  • ASClock.b4xlib
    2.8 KB · Views: 198

Alexander Stolte

Expert
Licensed User
Longtime User

Lello1964

Well-Known Member
Licensed User
Longtime User
Hi Alexander,
i want use AsRangeSlider + Asclock lib to set Alarm on off period.

But if i want set alarm on from 00:00 to 7:00 (ON) -- 1' period
13:00 to 15:00 (ON) -- 2' period
19:00 to 23:59 (ON) -- 3' period

In Italy time is based 24h, can you add 24h time dispaly to clock ?, fro 00 to 24 h

Raffaele
 

Theera

Well-Known Member
Licensed User
Longtime User
How to adjust size of middleText? if I need smaller ,or bigger.
 

dank

Member
Licensed User
Longtime User
I have a question about the analog hour hand. I would like it to move like it does on my watch. For example, at 2:30, the hour hand should be half way between 2 and 3. Is it possible with this library? Thanks.
 

Alexander Stolte

Expert
Licensed User
Longtime User
I have a question about the analog hour hand. I would like it to move like it does on my watch. For example, at 2:30, the hour hand should be half way between 2 and 3. Is it possible with this library? Thanks.
No idea what you mean. Download it, set the time to 2:30 and see if it looks the way you want.
 
Top