B4i Library Class Calendar

Hi all. Here the custom calendar class for B4A ( now for B4i ) by @Takeru17 ( https://www.b4x.com/android/forum/threads/custom-calendar-class.21996/ )

There are several things that could be arranged and / or added. If you update the same do not forget to share it.

IMG_0017.PNG

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.
    Public App As Application
    Public NavControl As NavigationController
    Private Page1 As Page
    
    Dim CsCal As CustomCalendar
    Dim ListDays As List

End Sub

Private Sub Application_Start (Nav As NavigationController)
    'SetDebugAutoFlushLogs(True) 'Uncomment if program crashes before all logs are printed.
    NavControl = Nav
    Page1.Initialize("Page1")
    Page1.Title = "Page 1"
    Page1.RootPanel.Color = Colors.White
    NavControl.ShowPage(Page1)
    
    
    ListDays.Initialize
    
    ListDays.Add(DateTime.Date(DateTime.Add(DateTime.Now, 0, 0, -5)))
    ListDays.Add(DateTime.Date(DateTime.Add(DateTime.Now, 0, 0, 5)))
    ListDays.Add(DateTime.Date(DateTime.Add(DateTime.Now, 0, 0, 10)))
    ListDays.Add(DateTime.Date(DateTime.Add(DateTime.Now, 0, 0, 15)))
    ListDays.Add(DateTime.Date(DateTime.Add(DateTime.Now, 0, 0, 35)))
    ListDays.Add(DateTime.Date(DateTime.Add(DateTime.Now, 0, 0, 45)))
    
    Dim newDate As Long = DateUtils.SetDate(2018, 3, 21)
    ListDays.Add(DateTime.Date(newDate))
    '* * *

    If CsCal.SomeTime > 0 Then
        CsCal.Initialize(Me, "CsCal" ,100%x, 100%y, CsCal.SomeTime, ListDays)
    Else
        CsCal.Initialize(Me, "CsCal" ,100%x, 100%y, DateTime.Now, ListDays)
    End If
    
    Page1.RootPanel.AddView(CsCal.AsView,0,0%y,100%x,100%y)
    CsCal.SetBackGroundColor(Colors.White)
    CsCal.ShowCalendar(True)
    
End Sub


Sub CsCal_ItemClick(dt As Long)
    
    
    ' Comment out ALL lines below for production use.  Use dt param above (selected date) as you wish...
    'CsCal.SetActiveButtonColor(Colors.Blue)
    
    Dim aa,dd,mm As Int
    aa=DateTime.GetYear(dt)
    dd=DateTime.GetDayOfMonth(dt)
    mm=DateTime.GetMonth(dt)
    
    
    Dim id_trattamento As String = aa & "-" & mm & "-" & dd
    Log(id_trattamento)
    
        
    
End Sub

In attachment example.
Bye
Marco
 

Attachments

  • Calendar.zip
    7 KB · Views: 77
Last edited:

tzfpg

Active Member
Licensed User
Longtime User
Hi,

Where I using on iphone, it work ok
Where I using on ipad, it can't show full the CustomCalendar.
Is there any way to make both Iphobe and Ipad compatible?

Thank you
 

Attachments

  • IMG_0042.PNG
    IMG_0042.PNG
    148.2 KB · Views: 23
Top