B4J Question [ SOLVED ] ASScheduler_AgendaView - Customize template

FabioRome

Member
Licensed User
Longtime User
Good morning,
I can't change the theme color in the agenda view mode, the instructions have no effect on the text, they only work for the background

B4X:
Public Sub Show (MainPane As Pane, MainForm As Form)
' DATI di TEST inizio
    
    ASSchedulerUtils.API.ClearAppointments
    ASSchedulerUtils.API.ClearBlackouts
    ASSchedulerUtils.API.ClearSpecialDays
    
    Dim StartDate As Long = DateUtils.SetDateAndTime(DateTime.GetYear(DateTime.Now),DateTime.GetMonth(DateTime.Now),DateTime.GetDayOfMonth(DateTime.Now),8,0,0)

    ASSchedulerUtils.API.CreateAppointment(ASSchedulerUtils.CreateASScheduler_Appointment(0,"Test Attività 1","Appo descrizione",xui.Color_ARGB(255,73, 98, 164),False,StartDate,StartDate + DateTime.TicksPerHour*1))
    ASSchedulerUtils.API.CreateAppointment(ASSchedulerUtils.CreateASScheduler_Appointment(0,"Test Attività 2","Appo descrizione",xui.Color_ARGB(255,141, 68, 173),False,StartDate,StartDate + DateTime.TicksPerHour*1))
    ASSchedulerUtils.API.CreateAppointment(ASSchedulerUtils.CreateASScheduler_Appointment(0,"Test Attività 3","Appo descrizione",xui.Color_ARGB(255,45, 136, 121),False,StartDate,StartDate + DateTime.TicksPerHour*1))
    ASSchedulerUtils.API.CreateAppointment(ASSchedulerUtils.CreateASScheduler_Appointment(0,"Test Attività 4","Appo descrizione",xui.Color_ARGB(255,140, 198, 101),False,StartDate + DateTime.TicksPerDay,StartDate + DateTime.TicksPerDay + DateTime.TicksPerHour*1))
    
    'Recurring
    ASSchedulerUtils.API.CreateAppointment(ASSchedulerUtils.CreateASScheduler_AppointmentRecurring(0,"Attività ricorsiva 1","Appo descrizione",xui.Color_ARGB(255,85,139,110),False,StartDate + DateTime.TicksPerDay*7,StartDate + (DateTime.TicksPerDay*7) + DateTime.TicksPerHour*2,True,ASSchedulerUtils.Recurring_Week,1))
    
    '***Random Appointments
    Dim p As Period
    p.Initialize
    p.Days = -7
        
    For i = 0 To 15 -1
        p.Days = p.Days + i
        Dim Start As Long = DateUtils.AddPeriod(DateTime.Now,p)
        If DateUtils.IsSameDay(DateTime.Now,Start) Then Continue
        
        For i2 = 0 To Rnd(1,5)
            Start = Start + DateTime.TicksPerHour*(Rnd(1,4))
            ASSchedulerUtils.API.CreateAppointment(ASSchedulerUtils.CreateASScheduler_Appointment(0,"Test" & i2,"Appo descrizione",GetAppointmentColor,False,Start,Start + (DateTime.TicksPerHour*2)))
        Next
    Next
    
    
    p.Days = -12
    ASSchedulerUtils.API.CreateBlackout(ASSchedulerUtils.CreateASScheduler_Blackout(0,DateUtils.AddPeriod(DateTime.Now,p),DateUtils.AddPeriod(DateTime.Now,p) + (DateTime.TicksPerDay*4)))
''''' DATI di TEST - FINE
    
    Pane1 = MainPane
    frm = MainForm
    Pane1.LoadLayout("frm_AgendaView")

    CallSubDelayed (Me, "Theme_newTemplate")

    ASScheduler_AgendaView1.WeekNameShort = ASSchedulerUtils.CreateASScheduler_WeekNameShort("Lun","Mar","Mer","Gio","Ven","Sab", "Dom")
    ASScheduler_AgendaView1.MonthNameShort = ASSchedulerUtils.CreateASScheduler_MonthNameShort("Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre")

    
    ASScheduler_AgendaView1.StartDate = DateTime.Now 'DateTime.Now is default

    Dim OneSunday As Long = DateUtils.SetDate(2025,1,5)
    ASScheduler_AgendaView1.API.CreateSpecialDay(ASSchedulerUtils.CreateASScheduler_SpecialDayRecurring(0,"Dom",OneSunday,True,ASSchedulerUtils.Recurring_Week,1,True)) ' It doesn't work

    ASScheduler_AgendaView1.CreateScheduler 'Makes the Scheduler visible
    
End Sub

B4X:
Private Sub Theme_newTemplate
    
    Dim Theme As ASScheduler_AgendaView_Theme
    Theme.Initialize
    
    Theme.BackgroundColor_Body = xui.color_argb(180,180, 180, 180)
    Theme.BackgroundColor_CurrentDate = xui.Color_DarkGray
    Theme.BackgroundColor_EmptyState = xui.Color_ARGB(255,32, 33, 37)
    Theme.BackgroundColor_Month = xui.Color_ARGB(255,112, 0, 0)
    Theme.BackgroundColor_Week = xui.Color_DarkGray

    Theme.TextColor_CurrentDate = xui.Color_Black
    Theme.TextColor_Appointment = xui.Color_White
    Theme.TextColor_AppointmentDayOfMonth = xui.Color_White
    Theme.TextColor_AppointmentWeekDay = xui.Color_White
    Theme.TextColor_DayOfMonth = xui.Color_White
    Theme.TextColor_EmptyState = xui.Color_White
    Theme.TextColor_Month = xui.Color_White
    Theme.TextColor_Week = xui.Color_White
    
    ASScheduler_AgendaView1.SetTheme(Theme)
    If ASScheduler_AgendaView1.isCreated Then ASScheduler_AgendaView1.RefreshScheduler
    
End Sub
 

Alexander Stolte

Expert
Licensed User
Longtime User
wich text do you mean?
1743157051821.png
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
i don't quite know if i understand your problem, i changed the color to red:
B4X:
        Theme.TextColor_CurrentDate = xui.Color_Red
        Theme.TextColor_Appointment = xui.Color_Red
        Theme.TextColor_Week = xui.Color_Red
1743157983434.png


It is best to create a screenshot and mark the place where the wrong color is displayed, thank you.
 
Upvote 0

FabioRome

Member
Licensed User
Longtime User
I finally found the error, disabling
MainForm.Stylesheets.Add(File.GetUri(File.DirAssets, "modena.css"))
works

B4X:
Sub AppStart (Form1 As Form, Args() As String)

    MainForm = Form1
    MainForm.Show
    MainForm.Resizable = True
    MainForm.RootPane.LoadLayout("00_Main") 'Load the layout file.
    MainForm.Icon = fx.LoadImage(File.DirAssets, "icona.png")

'    MainForm.Stylesheets.Add(File.GetUri(File.DirAssets, "modena.css"))
    MainForm.Stylesheets.Add(File.GetUri(File.DirAssets, "modenaUpdate.css"))
  
  
    MainForm.RootPane.LoadLayout("Layout1")
  
    Theme_newTemplate

End Sub
 
Last edited:
Upvote 0
Top