[B4X] [XUI] [Old] AS CalendarAdvanced 📅 - OneRow/FiveRow Calendar - Expand and Collapse [Payware]

MarcoRome

Expert
Licensed User
Longtime User
If you set SetDateTimeLocale(GetPreferredLanguage) before you call CreateCalendar then no error occurs.
But why, i dont know.
This line is affected then:
B4X:
Log(DateUtils.SetDate(DateTime.GetYear(ticks),DateTime.GetMonth(ticks),DateTime.GetDayOfMonth(ticks)))
But this has nothing to do with the view, because if I add this line after I set the locale with your code, then it also crashes outside of the view.
It looks like you have to set "SetDateTimeLocale" directly to app start so that no error occurs.

B4X:
SetDateTimeLocale(GetPreferredLanguage)
Log(DateUtils.SetDate(DateTime.GetYear(DateTime.Now),DateTime.GetMonth(DateTime.Now),DateTime.GetDayOfMonth(DateTime.Now)))'crash outside of the view'
DateTime.DateFormat = "EEEE dd MMMM"
Label1.Text = DateTime.Date(DateTime.Now)
'SetDateTimeLocale("EN-en")

Yes, work without problem.
But out of curiosity, i also noticed that if you insert it at the end and insert a sleep (100) it works.
When debugging, it appears that before closing, (AsCalendar.Close) continues to execute the line of code for one more time
B4X:
Return DateUtils.SetDate(DateTime.GetYear(ticks),DateTime.GetMonth(ticks),DateTime.GetDayOfMonth(ticks))
and finding the changed format fails.
In fact, inserting a Sleep(100) after AsCalendar.Close there is no error
B4X:
....
ASCalendarAdvanced1.Close

Sleep(100)

SetDateTimeLocale(GetPreferredLanguage)
DateTime.DateFormat = "EEEE dd MMMM"
Label1.Text = DateTime.Date(DateTime.Now)
 

wimpie3

Well-Known Member
Licensed User
Longtime User
I've discovered two bugs which are visible in the demo code.

1. The calendar starts in week mode with Sunday indicated in red. Pull down the calendar to put it in month mode and the same Sunday is still red, while the other Sundays are white. Move the calendar to the next month and return to the previous month. Now all Sundays are red.

2. Pull down the calendar to put it in month mode. Slide calendar to the left to show January. Slide back. Shows February. Perfect! Now slide back to the left to show January and click on the button "Back to current date". You will return to February but for a short moment, the two last rows will be shown as weeks from March. After a second, the calendar will change the layout and one of those two rows will be removed.
 
Last edited:

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 2.19
    • Add Designer Property FirstDayOfWeek
    • VisibleRangeChange and VisibleRangeChanged are now also triggered when you expand the calendar
    • BugFixes
I've discovered two bugs which are visible in the demo code.
should be work now
 

wimpie3

Well-Known Member
Licensed User
Longtime User
Another bug? Setting BodyColor or OtherMonthBackgroundColor or setOtherMonthBackgroundColor in B4XPage_Created results in
B4X:
java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0

Also, this:
B4X:
ASCalendarAdvanced1.AddAppointmentType3(DateUtils.AddPeriod(DateTime.Now,p),xui.Color_ARGB(255,45, 136, 121),xui.Color_Magenta)
seems to be an allowed syntax? I'm not passing through an end date. This results in a weird visual behaviour (left side of the magenta color is rounded, right side is rectangular).

It also seems to be impossible to change the corner radius of Appointment type 3. This:
B4X:
ASCalendarAdvanced1.AppointmentType3_ItemPropertiest.corner_radius=20dip
does not change anything?

Request: is it possible to add a horizontal alignment property for the labels in AppointmentType2 (left/center/right)?
 
Last edited:

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 2.20
    • BugFixes
    • Add TextAlignment_Horizontal property to AppointmentType2_ItemProperties - LEFT,RIGHT,CENTER
      • Default: CENTER
Setting BodyColor or OtherMonthBackgroundColor or setOtherMonthBackgroundColor in B4XPage_Created results in
B4X:
java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
Had not checked internally if the calendar was already built, thus it tried to update the visual area that was not yet built.
seems to be an allowed syntax? I'm not passing through an end date. This results in a weird visual behaviour (left side of the magenta color is rounded, right side is rectangular).
A date is a "Long" datatype and a color an "Int", apparently he had no problem with the color, because it was a valid date.

does not change anything?
try it now.

Request: is it possible to add a horizontal alignment property for the labels in AppointmentType2 (left/center/right)?
added
 

wimpie3

Well-Known Member
Licensed User
Longtime User
Thank you, very cool you are so quick in adapting the code! I hope you don't mind the bug reports ?
 

wimpie3

Well-Known Member
Licensed User
Longtime User
Only makes the product better ;)
In that case, here is some new material :)

1. in the demo code, when you try to put the calendar in month mode by inserting
B4X:
ASCalendarAdvanced1.expand

right after
B4X:
ASCalendarAdvanced1.Updateall

I get a crash:

B4X:
Error occurred on line: 382 (ASViewPager)
java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0

2. it seems that the parameter setExtraItemGap is not doing anything at all. No matter what value I put there, nothing changes on the calendar.

New request 1: if I'm correct, the color/radius of the circle on TODAYs date cannot be modified (or perhaps I'm overlooking something?). What I'd like to do is to disable the indicator (I'm okay with using a transparent color if that's easier for you) and to show today's day number with a BOLD text property.

New request 2: add the possibility to play with the spacing between two rows. As you can see on the screenshot, the round bullets from the appointments are glued against the green color from the next week. Would be cool if some optional spacing could be inserted there.

1644480350728.png
 
Last edited:

Alexander Stolte

Expert
Licensed User
Longtime User
2. it seems that the parameter setExtraItemGap is not doing anything at all. No matter what value I put there, nothing changes on the calendar.
Read the function descriptions.
"'sets the ExtraItemGab - is to prevent the font from covering the month number
'Default 6dip
'call CommitStyleChanges if you change the value"

6dip
1644518692885.png

20dip
1644518706365.png
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 2.21
    • CrashFix - UpdateBody
    • Add CurrentDateProperties - you can now customize the current date
      • TextColor
      • TextFont
      • IndicatorColor
      • IndicatorCornerRadius
      • IndicatorHeight
    • Add SelectedDateProperties - you can now customize the selected date indicator
      • IndicatorColor
      • IndicatorCornerRadius
      • IndicatorHeight
    • Add AppointmentType1_ItemProperties
      • Height
        • Default: 5dip
      • Padding
        • Default: 0dip
CurrentDateProperties
Turn this:
1644522610416.png

Into this:
1644522625155.png

with:
B4X:
ASCalendarAdvanced1.CurrentDateProperties.TextFont = xui.CreateDefaultBoldFont(20)
ASCalendarAdvanced1.CurrentDateProperties.TextColor = xui.Color_Black
ASCalendarAdvanced1.CurrentDateProperties.IndicatorColor = xui.Color_ARGB(100,255,255,255)
ASCalendarAdvanced1.CurrentDateProperties.IndicatorCornerRadius = 5dip
ASCalendarAdvanced1.CommitStyleChanges
AppointmentType1_ItemPropertiest
Turn this:
1644522685976.png

Into this:
1644522740162.png

with:
B4X:
ASCalendarAdvanced1.AppointmentType1_ItemPropertiest.Padding = 10dip
ASCalendarAdvanced1.AppointmentType1_ItemPropertiest.Height = 7dip
 

Cebuvi

Active Member
Licensed User
Longtime User
Hello,

I have copied ASViewPager version 1.27 into the folder Additional Libraries and I get this error.


ASCalendar.jpg






Where is the problem?

Thanks.
 

Alexander Stolte

Expert
Licensed User
Longtime User
Where is the problem?
You need the ASViewPager.
 

Cebuvi

Active Member
Licensed User
Longtime User
I already have ASVewPager in Additional Libraries.

I have downloaded the AS Viewpager example and it works perfectly.
 
Top