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: 280
  • AS_WheelDateTimePicker.b4xlib
    6.7 KB · Views: 283
Last edited:

Alexander Stolte

Expert
Licensed User
Longtime User
works fine here in release mode. I saved a file in the first page -> open the second page -> save a file again -> works fine
Did you have the newest AS_WheelPicker version?
 

marcick

Well-Known Member
Licensed User
Longtime User
The crash is only in release mode, both on a real device and Android Studio emulator
 

marcick

Well-Known Member
Licensed User
Longtime User
And what is the error message?

As I click on "save file" this is the error:

B4X:
RDC total: 0 records, time = 0.208 sec
** Activity (main) Pause event (activity is not paused). **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
** Activity (main) Pause event (activity is not paused). **
java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 654596 bytes
Bundle stats:
  android:viewHierarchyState [size=654332]
    android:views [size=653732]
PersistableBundle stats:
  [null]
    at android.app.servertransaction.PendingTransactionActions$StopInfo.run(PendingTransactionActions.java:146)
    at android.os.Handler.handleCallback(Handler.java:958)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:205)
    at android.os.Looper.loop(Looper.java:294)
    at android.app.ActivityThread.main(ActivityThread.java:8177)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
Caused by: android.os.TransactionTooLargeException: data parcel size 654596 bytes
    at android.os.BinderProxy.transactNative(Native Method)
    at android.os.BinderProxy.transact(BinderProxy.java:584)
    at android.app.IActivityClientController$Stub$Proxy.activityStopped(IActivityClientController.java:1439)
    at android.app.ActivityClient.activityStopped(ActivityClient.java:96)
    at android.app.servertransaction.PendingTransactionActions$StopInfo.run(PendingTransactionActions.java:135)
    ... 8 more
 

marcick

Well-Known Member
Licensed User
Longtime User
I mean I abandon this library because doesn’t suit my needing and has problems (but it works at your home so, peace and love). I come back to standard spinner and date picker. Thanks for your support.
 

Alexander Stolte

Expert
Licensed User
Longtime User
TransactionTooLargeException
The problem lies with the device. The DatePicker adds a large number of items to the list so that you can select 2 years into the past and 2 years into the future.
And can be solved by using the "MinDate" property before calling ".Create". And give this e.g. the value DateTime.Now, then the list is smaller and your device does not get into a memory problem.

I abandon this library because doesn’t suit my needing
If it doesnt suit your needing, then do it with the AS_WheelPicker with your own items?
Thanks for your support.
No Problem.
 

marcick

Well-Known Member
Licensed User
Longtime User
Understand.
why didn’t you give before this explanation if you knew it ?
I like much the appearance of your picker that looks like IOS style and I’m distributing the App for both platforms (better if it has the same look) but I have to abandon it for these reasons:
  1. We are in Italy and I want the date time is represented as we in Italy are used to
  2. In my application I can’t limit the time span. I could limit the future to today (there are no data to show for the future) but two years in the past is also not enough.
 

Alexander Stolte

Expert
Licensed User
Longtime User
why didn’t you give before this explanation if you knew it ?
Because I had a lot to do privately and had no opportunity to check on the PC?
but two years in the past is also not enough.
Then a normal DatePicker is more suitable, as a user I would not want to scroll through over 730 days to select a date that is more than 2 years in the past.
 

Alexander Stolte

Expert
Licensed User
Longtime User
We are in Italy and I want the date time is represented as we in Italy are used to
Italy has the same date format as Germany. But it is simply not possible to redesign the whole thing in a view which is a 2 in 1 view so that everything is dynamic, especially if you can only work with index. A custom solution would be much better.
 

MarcoRome

Expert
Licensed User
Longtime User
Hi dear.
I use rel. 3.23 WheelPicker and rel.1.15 As_WheelDateTimePicker
I have this code:
B4X:
Sub B4XPage_Appear
    
    AS_WheelDateTimePicker3.Date = DateTime.Now
    AS_WheelDateTimePicker3.Hour = DateTime.GetHour(DateTime.Now)
    AS_WheelDateTimePicker3.Minute = DateTime.GetMinute(DateTime.Now)
    
    AS_WheelDateTimePicker3.MinDate = DateTime.Now + DateTime.TicksPerDay
    AS_WheelDateTimePicker3.MaxDate = DateTime.Now + DateTime.TicksPerDay*5
        
        
    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
End Sub

The minimum date is respected, the maximum date continues regardless of the line code

B4X:
AS_WheelDateTimePicker3.MaxDate = DateTime.Now + DateTime.TicksPerDay*5

Where i wrong ?
 

Alexander Stolte

Expert
Licensed User
Longtime User
I use rel. 3.23 WheelPicker and rel.1.15 As_WheelDateTimePicker
I have this code:
B4X:
Sub B4XPage_Appear

AS_WheelDateTimePicker3.Date = DateTime.Now
AS_WheelDateTimePicker3.Hour = DateTime.GetHour(DateTime.Now)
AS_WheelDateTimePicker3.Minute = DateTime.GetMinute(DateTime.Now)

AS_WheelDateTimePicker3.MinDate = DateTime.Now + DateTime.TicksPerDay
AS_WheelDateTimePicker3.MaxDate = DateTime.Now + DateTime.TicksPerDay*5


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
End Sub
The minimum date is respected, the maximum date continues regardless of the line code

B4X:
AS_WheelDateTimePicker3.MaxDate = DateTime.Now + DateTime.TicksPerDay*5
Where i wrong ?
Hi, please make a new thread for any questions you have. And please provide an example project that shows all your settings and the behavior. Thank you very much, have a good start into the week.
 
Top