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

ykucuk

Well-Known Member
Licensed User
Longtime User
Thank you great library. I have some questions.

1- I changed BodyColor to white. The first 2 months' color is not white but after 2 months body background is white. Please check the screenshot. ( i'm moving one month to another. so the gray bg is April and the white one is May.

2-I changed BodyColor to white. I can't see Day's name. How to change the day's name color. Please check the screenshot.

B4X:
AS_DatePicker1.BodyProperties.TextColor = Main.ColorPrimary
AS_DatePicker1.HeaderProperties.TextColor = Colors.Magenta
AS_DatePicker1.SelectedDateColor= Main.ColorSecondary
 AS_DatePicker1.BodyProperties.xFont=xui.CreateFont2(Font.CreateNew2(Main.FontRegular,16),16)
AS_DatePicker1.HeaderProperties.xFont=xui.CreateFont2(Font.CreateNew2(Main.FontRegular,16),16)
AS_DatePicker1.CurrentDateColor=Colors.ARGB(100,100,100,100)
AS_DatePicker1.HeaderPanel.Color=Main.ColorPrimary
AS_DatePicker1.HeaderColor=Colors.Cyan
AS_DatePicker1.BodyColor=Colors.White
 

Attachments

  • Screenshot 2023-03-21 at 11.45.36 PM.png
    41.9 KB · Views: 230

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.19
    • BugFixes
    • Add get and set WeekNameProperties
1- I changed BodyColor to white. The first 2 months' color is not white but after 2 months body background is white. Please check the screenshot. ( i'm moving one month to another. so the gray bg is April and the white one is May.
If you change properties that change the appearance, then always call a .Refresh afterwards!
If you change anything in the header, then call .RefreshHeader
I will add this in all property descriptions in the next update, I thought it already is.
2-I changed BodyColor to white. I can't see Day's name. How to change the day's name color. Please check the screenshot.
B4X:
AS_DatePicker.WeekNameProperties.Color = xui.Color_Red
AS_DatePicker.WeekNameProperties.xFont = xui.CreateDefaultBoldFont(25)
AS_DatePicker.Refresh
 

tzfpg

Active Member
Licensed User
Longtime User
I play around the library, ramdomly get error message
error messages:
Error occurred on line: 152 (jPager)
java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
    at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
    at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
    at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
    at java.base/java.util.Objects.checkIndex(Objects.java:373)
    at java.base/java.util.ArrayList.get(ArrayList.java:426)
    at javafx.base/com.sun.javafx.collections.ObservableListWrapper.get(ObservableListWrapper.java:89)
    at javafx.base/com.sun.javafx.collections.VetoableListDecorator.get(VetoableListDecorator.java:306)
    at anywheresoftware.b4j.objects.PaneWrapper.GetNode(PaneWrapper.java:376)
    at anywheresoftware.b4a.objects.B4XViewWrapper.GetView(B4XViewWrapper.java:518)
    at b4j.example.jpager._setindexintern(jpager.java:579)
    at b4j.example.jpager._setindex(jpager.java:369)
    at b4j.example.asviewpager._setcurrentindex2(asviewpager.java:249)
    at b4j.example.as_datepicker$ResumableSub_CreateYearView.resume(as_datepicker.java:1959)
    at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:47)
    at jdk.internal.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:629)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:237)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
    at jdk.internal.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
    at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:100)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
    at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:42)
    at anywheresoftware.b4a.keywords.Common$2$1.run(Common.java:1051)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
    at java.base/java.lang.Thread.run(Thread.java:832)
how to fix it? i play with date range, i pick the year 2019 and then pick month to Feb select the day, and i also set min_date to start day, after i want pick the year again show error message.
 

Attachments

  • error.png
    6.3 KB · Views: 94
Last edited:

Theera

Well-Known Member
Licensed User
Longtime User
I'm not Christain,Please give property of year which can changed C.E. Year to B.E. Year. (2023->2566). Thank you in advance. I'm looking for cross platform library.
 

Alexander Stolte

Expert
Licensed User
Longtime User
If possible...
Unfortunately this is not possible, I use the "DateUtils.GetMonthName" function to determine this name.
You can change this directly by calling up the label. But a PageChanged event is still missing in this lib. This is coming soon, I have already received a request in another view.
B4X:
Dim xlbl_Header As B4XView = AS_DatePicker1.HeaderPanel.GetView(0)
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.24
    • Add get CurrentView
    • Add Event CustomDrawHeader
    • BugFixes
CustomDrawHeader
B4X:
Private Sub AS_DatePicker1_CustomDrawHeader(Date As Long,Views As ASDatePicker_CustomDrawHeader)
    If AS_DatePicker1.CurrentView = AS_DatePicker1.CurrentView_MonthView Then
        Views.xlbl_Text.Text = "Test " & DateUtils.GetMonthName(Date)
    End If
End Sub
 
Last edited:

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.25
    • Add "Height" to ASDatePicker_WeekNameProperties
      • Default: 20dip
    • Add "CurrentAndSelectedDayHeight" to ASDatePicker_BodyProperties
      • Default: 30dip
    • Add "SelectedTextColor" to ASDatePicker_BodyProperties
      • Default: White
 

Aldo's

Active Member
Licensed User
Hi,
I have two problem.
I wrote this code:
B4X:
    DateTime.DateFormat="dd/MM/yyyy"
    dpData.MinDate=DateTime.DateParse("01/12/2019")
    dpData.MaxDate=DateTime.DateParse("03/12/2051")
    dpData.FirstDayOfWeek=6
    dpData.CreateASDatePicker_WeekNameShort("LU","MA","ME","GI","VE","SA","DO")
    dpData.Refresh
but it keeps the short names of the days in English and starts the week on Monday instead of Sunday.
Can you tell me where I'm wrong?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…