B4A Library [B4X] [XUI] DateTimePicker View

jtare

Active Member
Licensed User
DateTimePicker view is based on the CustomListView with a design similar to the ios datetime picker. This view has only been tested in B4A, it is not very useful in B4i since for ios the built-in picker is better.


Screenshot_20200524-010539.jpg


Add the module and layout to your project (attached files). You should not modify this layout, it is for internal use only.
Add the DateTimePicker view in the designer
Set the min,max dates and it is ready to use.

Example:
B4X:
Sub Globals
    Private DateTimePicker1 As DateTimePicker
End Sub
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("1")
  
    ToastMessageShow("Click the activity",True)
    DateTimePicker1.SetMinDate(DateTime.Now-DateTime.TicksPerDay*15)
    DateTimePicker1.SetMaxDate(DateTime.Now+DateTime.TicksPerDay*15)
    DateTimePicker1.SetSelectedValue(DateTime.Now)
    DateTimePicker1.Show
End Sub
Sub Activity_Click
    If DateTimePicker1.Selected > 0 Then
        Log($"$DateTime{DateTimePicker1.Selected}"$)
        ToastMessageShow($"$DateTime{DateTimePicker1.Selected}"$,True)
    End If
End Sub
 

Attachments

Last edited:

oparra

Well-Known Member
Licensed User
Congratulations,

It could be expanded with more options like this class does.


regards.
 

Cebuvi

Active Member
Licensed User
Would it be possible that the minutes and seconds were in a continuous wheel?
That is: 57 58 59 0 1 ......... 57 58 59 0

Thanks.
 
Top