B4i Library Class Calendar

Discussion in 'iOS Libraries' started by MarcoRome, Mar 6, 2018.

  1. MarcoRome

    MarcoRome Expert Licensed User

    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

    Code:
    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, 00, -5)))
        ListDays.Add(
    DateTime.Date(DateTime.Add(DateTime.Now, 005)))
        ListDays.Add(
    DateTime.Date(DateTime.Add(DateTime.Now, 0010)))
        ListDays.Add(
    DateTime.Date(DateTime.Add(DateTime.Now, 0015)))
        ListDays.Add(
    DateTime.Date(DateTime.Add(DateTime.Now, 0035)))
        ListDays.Add(
    DateTime.Date(DateTime.Add(DateTime.Now, 0045)))
        
        
    Dim newDate As Long = DateUtils.SetDate(2018321)
        ListDays.Add(
    DateTime.Date(newDate))
        
    '* * *

        
    If CsCal.SomeTime > 0 Then
            CsCal.Initialize(Me, 
    "CsCal" ,100%x100%y, CsCal.SomeTime, ListDays)
        
    Else
            CsCal.Initialize(Me, 
    "CsCal" ,100%x100%yDateTime.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
     

    Attached Files:

    Last edited: Mar 6, 2018
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice