B4A Library [B4X] [XUI] AS DatePicker - fast navigate to a Month - Year - Decade - Century

This is a simple DatePicker, with which you can quickly reach your target date. With a click on the header the view changes.

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. :)
  • In the month view, you can select a date
  • In the year view, you select a month
  • In the decade you see a range of 10 years
  • In century you can see 100 years
HBCw9HcyQl51OlUSlkTang3geQJQGCYaAtbFvJ4bHaAfHiPt9x.jpeg
MAvotbEkSVF012K5ZvMBXJBMgq0gdeN8BNFT10UVz925EIRgvN.jpeg
nVlr2QIwJribjmnzAht8UhSPd4iMa2mYrVlHtXWb5z33PdchLN.jpeg
a9iPjjQcHMfthkQ2evsSQi52cxy4CGsF1OEBRKeyykkYFbz1Pd.jpeg


1651251003803.png

Make sure you are using ASViewPager V1.31+
ASDatePicker
Author: Alexander Stolte
Version: 1.00

  • ASDatePicker_HeaderProperties
    • Fields:
      • Height As Float
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASDatePicker_MonthNameShort
    • Fields:
      • April As String
      • August As String
      • December As String
      • February As String
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • January As String
      • July As String
      • June As String
      • March As String
      • May As String
      • November As String
      • October As String
      • September As String
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASDatePicker_WeekNameShort
    • Fields:
      • Friday As String
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • Monday As String
      • Saturday As String
      • Sunday As String
      • Thursday As String
      • Tuesday As String
      • Wednesday As String
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • AS_DatePicker
    • Events:
      • SelectedDateChanged (Date As Long)
    • Fields:
      • mBase As B4XView
      • Tag As Object
    • Functions:
      • ChangeView (NewView As String)
      • Class_Globals As String
      • CreateASDatePicker_HeaderProperties (Height As Float) As ASDatePicker_HeaderProperties
      • CreateASDatePicker_MonthNameShort (January As String, February As String, March As String, April As String, May As String, June As String, July As String, August As String, September As String, October As String, November As String, December As String) As ASDatePicker_MonthNameShort
      • CreateASDatePicker_WeekNameShort (Monday As String, Tuesday As String, Wednesday As String, Thursday As String, Friday As String, Saturday As String, Sunday As String) As ASDatePicker_WeekNameShort
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map) As String
        Base type must be Object
      • getBodyColor As Int
      • getCurrentDateColor As Int
      • getCurrentView_CenturyView As String
      • getCurrentView_DecadeView As String
      • getCurrentView_MonthView As String
      • getCurrentView_YearView As String
      • GetFirstDayOfWeek2 (Ticks As Long, FirstDayOfWeek As Int) As Long
        FirstDayOfWeek:
        Friday = 1
        Thursday = 2
        Wednesday = 3
        Tuesday = 4
        Monday = 5
        Sunday = 6
        Saturday = 7
      • getHeaderColor As Int
      • getHeaderPanel As B4XView
        You can customize the appereance of the header
        With the following code you can customize the control elements that are visible in the header:
        <code>
        'Middle Text Label
        Dim xlbl_Header As B4XView = AS_DatePicker1.HeaderPanel.GetView(0)
        'Left Arrow Label
        Dim xlbl_ArrowLeft As B4XView = AS_DatePicker1.HeaderPanel.GetView(1)
        'Right Arrow Label
        Dim xlbl_ArrowRight As B4XView = AS_DatePicker1.HeaderPanel.GetView(2)
        </code>
      • getSelectedDateColor As Int
      • GetWeekNameByIndex (Index As Int) As String
        1 = Sunday
      • Initialize (Callback As Object, EventName As String) As String
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • setBodyColor (Color As Int) As String
      • setCurrentDateColor (Color As Int) As String
      • setFirstDayOfWeek (number As Int) As String
        1-7
        Friday = 1
        Thursday = 2
        Wednesday = 3
        Tuesday = 4
        Monday = 5
        Sunday = 6
        Saturday = 7
      • setHeaderColor (Color As Int) As String
      • setSelectedDateColor (Color As Int) As String
    • Properties:
      • BodyColor As Int
      • CurrentDateColor As Int
      • CurrentView_CenturyView As String [read only]
      • CurrentView_DecadeView As String [read only]
      • CurrentView_MonthView As String [read only]
      • CurrentView_YearView As String [read only]
      • FirstDayOfWeek
        1-7
        Friday = 1
        Thursday = 2
        Wednesday = 3
        Tuesday = 4
        Monday = 5
        Sunday = 6
        Saturday = 7
      • HeaderColor As Int
      • HeaderPanel As B4XView [read only]
        You can customize the appereance of the header
        With the following code you can customize the control elements that are visible in the header:
        <code>
        'Middle Text Label
        Dim xlbl_Header As B4XView = AS_DatePicker1.HeaderPanel.GetView(0)
        'Left Arrow Label
        Dim xlbl_ArrowLeft As B4XView = AS_DatePicker1.HeaderPanel.GetView(1)
        'Right Arrow Label
        Dim xlbl_ArrowRight As B4XView = AS_DatePicker1.HeaderPanel.GetView(2)
        </code>
      • SelectedDateColor As Int
Changelog
  • 1.00
    • Release
  • 1.01
    • Add Scroll2Date - Scrolls to the date
    • B4J Resize BugFixes
  • 1.02
    • BugFixes
    • Add designer property InactiveDaysVisible - Displays the days that are not in the current month
      • Default: False
    • Add Type ASDatePicker_BodyProperties
      • Font of the Text
      • TextColor of the Text
    • The month view now has 6 lines instead of 5
      • It may be that if InactiveDaysVisible = False that an empty line is seen
  • 1.03
    • B4J Only - Add Designer Property MouseHoverFeedback
      • Default: True
  • 1.04
    • Add Refresh
  • 1.05
    • Added a border to the current month, year, or century in the quick navigation
  • 1.06
    • Add get and set SelectedDate
    • Add Event CustomDrawDay
    • Add Type ASDatePicker_CustomDrawDay
  • 1.07
    • BugFix
  • 1.08
    • Add get and set BodyProperties
    • Add get and set HeaderProperties
    • Function "Refresh" is now even better
      • No visual flickering
      • Changes are instant
  • 1.09 (read more)
    • Add get and set MaxDate - Will restrict date navigations features of forward, and also cannot swipe the control using touch gesture beyond the max date range
    • Add get and set MinDate - Will restrict date navigations features of backward, and also cannot swipe the control using touch gesture beyond the max date range
    • Add Rebuild - Clears the DatePicker and builds the DatePicker new
  • 1.10 (read more)
    • Add Designer property SelectMode -
      • Default: Date
  • 1.11
    • BugFixes
  • 1.12
    • Add RefreshHeader - Applies the header properties if any have been changed
    • New ASDatePicker_HeaderProperties properties
Have Fun :)
 

Attachments

  • AS DatePicker Example.zip
    69.4 KB · Views: 200
  • AS_DatePicker.b4xlib
    7.7 KB · Views: 49
Last edited:

Alexander Stolte

Expert
Licensed User
Update
  • 1.10
    • Add Designer property SelectMode -
      • Default: Date
  • 1.11
    • BugFixes
  • 1.12
    • Add RefreshHeader - Applies the header properties if any have been changed
    • New ASDatePicker_HeaderProperties properties
SelectMode - Month
In this mode you do not select a day, but a month.
AS_DatePicker SelectMode Month.gif
 
Last edited:
Top