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

Alexander Stolte

Expert
Licensed User
Longtime 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.
 
Last edited:

BugNot

Member
Hi,

How to add an image on a specific day of the calendar?

Thanks

B4X:
Private Sub AS_DatePicker1_CustomDrawDay (Date As Long, Views As ASDatePicker_CustomDrawDay)
    'Color week-end
    If DateTime.GetDayOfWeek(Date) = 7 Then
        Views.xlbl_Date.TextColor = xui.Color_ARGB(255,221, 95, 96)
    else If DateTime.GetDayOfWeek(Date) = 1 Then
        Views.xlbl_Date.TextColor = xui.Color_ARGB(255,221, 95, 96)
    End If


    'Add a image    
    If DateTime.GetDayOfMonth = 7 Then
        Views.xlbl_Date.AddView....'What next for add a image?
    End If
 

Alexander Stolte

Expert
Licensed User
Longtime User
B4X:
Private Sub AS_DatePicker1_CustomDrawDay (Date As Long, Views As ASDatePicker_CustomDrawDay)
    
    Views.xlbl_Date.Height = 20dip
    
    If DateTime.GetDayOfMonth(Date) = 7 Then
        
        Dim xiv As B4XView = CreateImageView("")
        Views.BackgroundPanel.AddView(xiv,0,Views.xlbl_Date.Height,Views.BackgroundPanel.Width,Views.BackgroundPanel.Height - Views.xlbl_Date.Height)
        xiv.SetBitmap(xui.LoadBitmapResize(File.DirAssets,"tothemoon.png",xiv.Width,xiv.Height,True))
        
    End If
    
End Sub

Private Sub CreateImageView(EventName As String) As B4XView   
    Dim iv As ImageView
    iv.Initialize(EventName)
    Return iv   
End Sub
 

BugNot

Member

many thanks alexander
 

BugNot

Member
To try :

B4X:
AS_DatePickerTimeline1.CreateASDatePicker_WeekNameShort("Lun", "Mar", "Mer", "Jeu","Ven", "Sam", "Dim")
 

Daica

Active Member
Licensed User
Awesome!

I don't see the method to get the selected ranges from the DatePicker. Am I missing something?
Something like SelectedRange.StartDate and SelectedRange.EndDate

Also, is it not possible to select a single date within "Range" mode?
 

Alexander Stolte

Expert
Licensed User
Longtime User
I don't see the method to get the selected ranges from the DatePicker. Am I missing something?
Something like SelectedRange.StartDate and SelectedRange.EndDate
There are one new event SelectedDateRangeChanged.
Also, is it not possible to select a single date within "Range" mode?
But the normal SelectedDay event is triggered when only 1 day is selected.
 

Daica

Active Member
Licensed User
Download the lib. again, there is now a get SelectedStartDate and SelectedEndDate property.

Idea/Suggestion:

In future versions could you include ability to manually set the SelectedStartDate and SelectedEndDate so that when the calendar is opened, those dates are selected already?
 

Alexander Stolte

Expert
Licensed User
Longtime User
ability to manually set the SelectedStartDate and SelectedEndDate so that when the calendar is opened, those dates are selected already?
Download the lib. again, there is now a set SelectedStartDate and SelectedEndDate property.
B4X:
AS_DatePicker1.SelectedStartDate = DateTime.Now
AS_DatePicker1.SelectedEndDate = DateTime.Now + DateTime.TicksPerDay*3
 

Daica

Active Member
Licensed User
Do you think its possible to add a feature where when you're in "Range" mode, you can press and hold down on a date to select a single day?
When a single day is selected maybe it can just return the same date for both start and end date?

Currently in range mode, you have to select 2 different dates, sometimes, people only want to select a single day instead.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…