B4A Library [B4X] AS WheelDateTimePicker - based on ASWheelPicker

This is a date and time picker in IOS picker design.

This library is based on the ASWheelPicker, without it the library will not work.

EQ5gfV8j4u2d3PaEtXi6p57dQCY9h7883CRjIizpVHqLx7YXhY.jpeg

Use:
B4X:
AS_WheelDateTimePicker1.Create

ASWheelDateTimePicker
Author: Alexander Stolte
Version: 1.00

  • ASWheelDateTimePicker_MonthName
    • 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.
  • ASWheelDateTimePicker_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.
  • ASWheelDateTimePicker_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_WheelDateTimePicker
    • Events:
      • SelectedDateChanged (Date As Long)
      • SelectedTimeChanged (Hour As Int, Minute As Int)
    • Fields:
      • mBase As B4XView
      • Tag As Object
    • Functions:
      • Class_Globals As String
      • CreateASWheelDateTimePicker_MonthName (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 ASWheelDateTimePicker_MonthName
      • CreateASWheelDateTimePicker_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 ASWheelDateTimePicker_MonthNameShort
      • CreateASWheelDateTimePicker_WeekNameShort (Monday As String, Tuesday As String, Wednesday As String, Thursday As String, Friday As String, Saturday As String, Sunday As String) As ASWheelDateTimePicker_WeekNameShort
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map) As String
        Base type must be Object
      • getHour As Int
      • getMinute As Int
      • Initialize (Callback As Object, EventName As String) As String
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
    • Properties:
      • Hour As Int [read only]
      • Minute As Int [read only]
Changelog
  • 1.00
    • Release
  • 1.01
    • BugFixes
  • 1.02
    • Add set Hour
    • Add set Minute
    • Add set Date
  • 1.03
    • Add Refresh
  • 1.04
    • BugFixes
    • PickerType = DatePicker - The days in the month now adjust automatically
    • Add Designer Property TextColor
    • Add Designer Property FadeColor
    • Add Designer Property HapticFeedback
  • 1.05
    • Add Designer Property TodayText
      • Default: Today
    • Add get and set TodayText - Call Refresh if you change something
  • 1.06
    • BugFixes
  • 1.07
    • BugFixes - AM and PM mode works now as expected
    • BugFixes - setDate Number of days is now adjusted
  • 1.08
    • Add get and set FadeColor
    • Add get and set TextColor
    • Add get and set SelectorColor
    • Add get and set BackgroundColor
    • MonthName now comes from the DateUtils
  • 1.09
    • BugFixes
  • 1.10
    • BugFixes
  • 1.11
    • Add Designer Property MinuteSteps - 1-5-10-15 Block Interval
      • Default: False
  • 1.12
    • BugFixes
  • 1.13
    • Add get WheelPicker - gets the wheelpicker to modify font etc.
  • 1.14 (read more)
    • You need AS_WheelPicker V3.15+ for this update
    • If a month has 30 or 28 days, then these are now no longer removed from the list, but the new EnabledRow is used and the affected items are deactivated.
      • This prevents the list from behaving in an unusual way.
    • Add MinDate and MaxDate - You can specify a DateRange what may be selected
  • 1.15
    • You need AS_WheelPicker V3.20+
    • Breaking Change: You need to call Create
      • The view will not be built without it
      • Now you can make changes to the proepties without calling refresh at the beginning
      • Faster loading time
      • No crashes
    • Add SetDateTextOrder - You can change the text order of the date text
    • BugFixes
    • Add Event CustomDrawItemChange
Have Fun :)
 

Attachments

  • AS WheelDateTimePicker Example.zip
    176.3 KB · Views: 273
  • AS_WheelDateTimePicker.b4xlib
    6.7 KB · Views: 276
Last edited:

arvin

Member
I can not install the lib, or i have another mistake?
I just copy "ASWheelPicker.b4xlib" to Libraries folder of B4A
 

Attachments

  • 1673635598059.png
    1673635598059.png
    200.2 KB · Views: 222

Alexander Stolte

Expert
Licensed User
Longtime User
ASWheelPicker.b4xlib
You need this lib. the DateTimePicker is based on this. The WheelPicker is not free to use.
 

Alexander Stolte

Expert
Licensed User
Longtime User
Is it possible to set a maximum and minimum date for the date picker?
A little information. I have already started working on the next update that will include exactly this. Unfortunately it is not an easy task to adapt this dynamically per runtime to the MinDate, I have already invested 2 hours and assume that I need at least 1-2 more hour of work time. The MaxDate is already inside and works smoothly.
 
Hi guys,
I want to set the "Color fade" to transparent in the designer, but it always throws me black in the app.
I tried by code
1683680499433.png


I tried by code before and after the refresh and I get the same error
B4X:
AS_WheelDateTimePicker1.FadeColor = Colors.Transparent
AS_WheelDateTimePicker1.MonthName = AS_WheelDateTimePicker1.CreateASWheelDateTimePicker_MonthName("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Sseptiembre","Octubre","Noviembre","Diciembre")
AS_WheelDateTimePicker1.Refresh
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.09
    • BugFixes
I want to set the "Color fade" to transparent in the designer, but it always throws me black in the app.
Hey please download the newest version of AS_WheelPicker and AS_WheelDateTimePicker.
Thanks
 

MarcoRome

Expert
Licensed User
Longtime User
Hi dear.
If you use this code in new version of libraries ( AS_WheelDateTime 1.09 + AsWheelPicker 3.13 ) dont work.

B4X:
AS_WheelDateTimePicker3.Date = DateTime.Now
    AS_WheelDateTimePicker3.Hour = DateTime.GetHour(DateTime.Now)
    AS_WheelDateTimePicker3.Minute = DateTime.GetMinute(DateTime.Now)
    
    AS_WheelDateTimePicker3.MonthNameShort =      AS_WheelDateTimePicker3.CreateASWheelDateTimePicker_MonthNameShort("Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic")
    AS_WheelDateTimePicker3.WeekNameShort = AS_WheelDateTimePicker3.CreateASWheelDateTimePicker_WeekNameShort("Lun","Mar","Mer","Gio","Ven","Sab","Dom")
    AS_WheelDateTimePicker3.Refresh


The date starts from January 1st.
The code works perfectly on older libraries ( 1.08 + 3.08 )
 

Attachments

  • Project.zip
    182.6 KB · Views: 183

MarcoRome

Expert
Licensed User
Longtime User
Hi dear.
Another thing that could be useful and give the times different steps.
For example currently if you select a time, the minutes start from 1,2,3,4, etc up to 59. It could be useful to make sure that, for example, you have the "wheel" of the minutes that can only be chosen with a step of 15 minutes, so for example by selecting the minutes we could see 15,30,45 or step 10 minutes for 10,20,30,40,50... and so.
 

MarcoRome

Expert
Licensed User
Longtime User
Hi Dear.
I downloaded version 1.12.
There are some problems. I also attach the project.
On android there is no problem, on iOS instead there are multiple problems, which i list below:
1. The AS_WheelDateTime object is not seen in the designer. as in the following picture.
1685022433608.png


2. If you enter AS_WheelDateTime and use the following code it crashes:
B4X:
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    'load the layout to Root
    Root.LoadLayout("lay_page2")
   
    Panel1.Visible = True
   
    DateTime.TimeFormat = DateTime.DeviceDefaultTimeFormat
    DateTime.DateFormat = DateTime.DeviceDefaultDateFormat
   
End Sub

'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.


Sub B4XPage_Appear
    AS_WheelDateTimePicker1.Date = DateTime.Now
    AS_WheelDateTimePicker1.Hour = DateTime.GetHour(DateTime.Now)
    AS_WheelDateTimePicker1.Minute = DateTime.GetMinute(DateTime.Now)
   
    AS_WheelDateTimePicker1.MonthNameShort = AS_WheelDateTimePicker1.CreateASWheelDateTimePicker_MonthNameShort("Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic")
    AS_WheelDateTimePicker1.WeekNameShort = AS_WheelDateTimePicker1.CreateASWheelDateTimePicker_WeekNameShort("Lun","Mar","Mer","Gio","Ven","Sab","Dom")
    AS_WheelDateTimePicker1.Refresh
End Sub

1685022491614.png

if you comment this line it doesn't crash

B4X:
AS_WheelDateTimePicker1.Date = DateTime.Now

but i have hours and minutes starting from 0 even if i enter this code:
B4X:
AS_WheelDateTimePicker1.Hour = DateTime.GetHour(DateTime.Now)
AS_WheelDateTimePicker1.Minute = DateTime.GetMinute(DateTime.Now)
 

Attachments

  • Project.zip
    188.7 KB · Views: 141

Alexander Stolte

Expert
Licensed User
Longtime User
1. The AS_WheelDateTime object is not seen in the designer. as in the following picture.
No idea why there are no events under the dialog, just use the right-click menu to list the events. I never use this generate event dialog.
2. If you enter AS_WheelDateTime and use the following code it crashes:
It is a mistake to process this in the B4XPage_Appear event.

Also, what if the user briefly puts the app in the background because they need to look something up somewhere else, then every time the previous entry is set to the current date.
 

MarcoRome

Expert
Licensed User
Longtime User
It is a mistake to process this in the B4XPage_Appear event.

If you insert it in Event Created the result does not change.

1685030799136.png


I had tried to insert it in the Appear event because if you insert a panel and inside the Panel insert the object when you open the app "lose" the following instructions
B4X:
AS_WheelDateTimePicker1.MonthNameShort = AS_WheelDateTimePicker1.CreateASWheelDateTimePicker_MonthNameShort("Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic")
    AS_WheelDateTimePicker1.WeekNameShort = AS_WheelDateTimePicker1.CreateASWheelDateTimePicker_WeekNameShort("Lun","Mar","Mer","Gio","Ven","Sab","Dom")
    AS_WheelDateTimePicker1.Refresh
and repeats everything in English
 

Alexander Stolte

Expert
Licensed User
Longtime User
The problem is not my lib. the problem is in the native scrollview. You are using AddPageAndCreate, the problem is, the panel is not visible. This is the same as if I make an xCustomListView invisible, then fill it and only then show it, an error occurs. And your panel where you put the view. on it, you also made invisible.

Make sure that when you build the view it is visible, that is important. And switch to AddPage instead of AddPageAndCreate.

I don't have time right now to write you a sample project that shows exactly this behavior with a simple xCustomListView.
 
Top