B4A Library SingleDateAndTimePicker

A partly wrap for this Github project. Posting:
1. B4A library files - extract them and copy them to your additional library folder
2. B4A sample project
3. LibRes.zip - extract the folder and copy it to the same folder level as that of the /Files and /Objects folders of the B4A project

1.gif


Library:

SingleDateAndTimePicker
Author:
Github: Florent CHAMPIGNY, Wrapped by: Johan Schoeman
Version: 1.03
  • SingleDateAndTimePicker
    Events:
    • date_time_changed (year As Int, month As Int, dayOfMonth As Int, dayOfWeek As Int, hour As Int, minute As Int, stringDateTime As String)
    Fields:
    • ALIGN_CENTER As Int
    • ALIGN_LEFT As Int
    • ALIGN_RIGHT As Int
    • ba As BA
    • mydate As String
    • mydayofmonth As Int
    • mydayofweek As Int
    • myhour As Int
    • myminute As Int
    • mymonth As Int
    • myyear As Int
    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]
    • Date As String [read only]
    • DayAtmospheric As Boolean [write only]
    • DayCurtain As Boolean [write only]
    • DayCurtainColor As Int [write only]
    • DayCurved As Boolean [write only]
    • DayCyclic As Boolean [write only]
    • DayIndicator As Boolean [write only]
    • DayIndicatorColor As Int [write only]
    • DayIndicatorSize As Int [write only]
    • DayItemAlign As Int [write only]
    • DayItemTextColor As Int [write only]
    • DaySelectedItemTextColor As Int [write only]
    • DayVisibleItemCount As Int [write only]
    • Enabled As Boolean
    • Height As Int
    • HourAtmospheric As Boolean [write only]
    • HourCurtain As Boolean [write only]
    • HourCurtainColor As Int [write only]
    • HourCurved As Boolean [write only]
    • HourCyclic As Boolean [write only]
    • HourIndicator As Boolean [write only]
    • HourIndicatorColor As Int [write only]
    • HourIndicatorSize As Int [write only]
    • HourItemAlign As Int [write only]
    • HourItemTextColor As Int [write only]
    • HourSelectedItemTextColor As Int [write only]
    • HourVisibleItemCount As Int [write only]
    • Left As Int
    • MinuteAtmospheric As Boolean [write only]
    • MinuteCurtain As Boolean [write only]
    • MinuteCurtainColor As Int [write only]
    • MinuteCurved As Boolean [write only]
    • MinuteCyclic As Boolean [write only]
    • MinuteIndicator As Boolean [write only]
    • MinuteIndicatorColor As Int [write only]
    • MinuteIndicatorSize As Int [write only]
    • MinuteItemAlign As Int [write only]
    • MinuteItemTextColor As Int [write only]
    • MinuteSelectedItemTextColor As Int [write only]
    • MinuteVisibleItemCount As Int [write only]
    • Parent As Object [read only]
    • ShowToastMessage As Boolean [write only]
    • Tag As Object
    • Top As Int
    • Visible As Boolean
    • Width As Int


Sample Code:
B4X:
#Region  Project Attributes
    #ApplicationLabel: b4aSingleDateAndTimePicker
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: portrait
    #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 sdtp1 As SingleDateAndTimePicker
    Private b1 As Button
    Dim monthlist As List
    Dim daylist As List
    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")
 
    monthlist.Initialize2(Array As String("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"))
    daylist.Initialize2(Array As String("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", " Friday", " Saturday"))
 
    sdtp1.DayCurtain = True
    sdtp1.DayCurtainColor = Colors.ARGB(100, 0, 255, 0)
    sdtp1.DayCurved = True
    sdtp1.DayIndicator = True
    sdtp1.DayIndicatorColor = Colors.Black
    sdtp1.DayItemTextColor = Colors.Red
    sdtp1.DaySelectedItemTextColor = Colors.Blue
    sdtp1.DayItemAlign = sdtp1.ALIGN_LEFT
    sdtp1.DayIndicatorSize = 5                              'the line thickness of the indicator
    sdtp1.DayVisibleItemCount = 7
    sdtp1.DayAtmospheric = True
    sdtp1.DayCyclic = True
 
 
    sdtp1.HourCurtain = True
    sdtp1.HourCurtainColor = Colors.ARGB(100, 255, 0, 0)
    sdtp1.HourCurved = True
    sdtp1.HourIndicator = True
    sdtp1.HourIndicatorColor = Colors.Magenta
    sdtp1.HourItemTextColor = Colors.Blue
    sdtp1.HourSelectedItemTextColor = Colors.Cyan
    sdtp1.HourItemAlign = sdtp1.ALIGN_LEFT
    sdtp1.HourIndicatorSize = 5                              'the line thickness of the indicator
    sdtp1.HourVisibleItemCount = 7
    sdtp1.HourAtmospheric = True
    sdtp1.HourCyclic = True 
 
 

    sdtp1.MinuteCurtain = False
    sdtp1.MinuteCurtainColor = Colors.ARGB(100, 0, 0, 175)
    sdtp1.MinuteCurved = True
    sdtp1.MinuteIndicator = True
    sdtp1.MinuteIndicatorColor = Colors.Blue
    sdtp1.MinuteItemTextColor = Colors.Cyan
    sdtp1.MinuteSelectedItemTextColor = Colors.Magenta
    sdtp1.MinuteItemAlign = sdtp1.ALIGN_LEFT
    sdtp1.MinuteIndicatorSize = 5                              'the line thickness of the indicator
    sdtp1.MinuteVisibleItemCount = 7
    sdtp1.MinuteAtmospheric = True
    sdtp1.MinuteCyclic = True     
 
 
    sdtp1.ShowToastMessage = False
 
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub sdtp1_date_time_changed(year As Int, month As Int, dayOfMonth As Int, dayOfWeek As Int, hour As Int, minute As Int, stringDateTime As String)
 
    Log("YEAR = " & year)
    Log("MONTH = " & monthlist.Get(month))
    Log("DAY OF MONTH = " & dayOfMonth)
    Log("DAY OF WEEK = " & daylist.Get(dayOfWeek))
    Log("HOUR = " & hour)
    Log("MINUTE = " & minute)
    Log("STRING DATE AND TIME = " & stringDateTime)
 
 
End Sub

Sub b1_Click
 
    Log(sdtp1.myyear)
    Log(monthlist.Get(sdtp1.mymonth))
    Log(sdtp1.mydayofmonth)
    Log(daylist.Get(sdtp1.mydayofweek))
    Log(sdtp1.myhour)
    Log(sdtp1.myminute)
    Log(sdtp1.mydate)
 
End Sub
 

Attachments

  • b4aSingleDateAndTimePicker.zip
    8.9 KB · Views: 668
  • LibRes.zip
    7.8 KB · Views: 640
  • 1.png
    1.png
    52.1 KB · Views: 651
  • SingleDateAndTimePickerLibFiles.zip
    65.2 KB · Views: 711
Last edited:

Allen21121

New Member
you forget to extract the content of LibRes.zip to your projectfolder?
I am looking for a Reminder Library that notify my phone, because i can't code it without the library. I'm making a app "Todo List" and I want to add a feature that reminds every task i put wtihout database.
 
Last edited:
Top