Hello,
Reading through the forum I stumbled upon a VB code that allows me to create multiple schedules in a calendar.
I have rewritten this code in both PowerBuilder and C# but the issue is:
In C# it works flawlessly while in PowerBuilder (2019 R3) it creates the schedules and all, but it doesn't let me Add any events, as if the calendar is disabled (which it isn't)
I will post down my code, I really can't wrap my head around this issue I hope you guys can help me.
Thank you in advance
// Impostazioni Visive Calendar.Object.VisualTheme = 5 Calendar.Width = this.Width * 0.9 Calendar.Height = this.Height * 0.9
// Mostro settimana Calendar.Object.DayView.ShowDays(Today(), RelativeDate(Today(), 14)) Calendar.Object.Options.DayViewTimeScaleShowMinutes(true)
// Dimensioni colonne Calendar.Object.DayView.MinColumnWidth = 25
// Imposto giorni e ore della settimana String min, max
min = '08:00' max = '18:00'
calendar.object.options.WorkWeekMask = 62 // Lun-Ven
calendar.object.options.WorkDayStartTime = min calendar.object.options.WorkDayEndTime = max
calendar.object.DayView.TimeScaleMinTime = min calendar.object.DayView.TimeScaleMaxTime = max calendar.object.DayView.TimeScale(15)
// ****************** // CATEGORIE MULTIPLE // ****************** OLEObject DataProvider OLEObject Schedules OLEObject Schedule OLEObject Resources OLEObject Resource
Calendar.Object.ReadOnlyMode = false Calendar.Object.MultipleSchedulesMode = true
// apro il data provider DataProvider = Calendar.Object.DataProvider IF NOT DataProvider.Open() THEN & DataProvider.Create()
Resources = CREATE OLEObject Resource = CREATE OLEObject
Schedules = DataProvider.Schedules Resources.ConnectToNewObject("Codejock.CalendarResources.18.6.0")
// Inserisco risorse Integer i Long scheduleId FOR i = 1 TO 3 Schedules.AddNewSchedule("G" + String(i)) Resource.ConnectToNewObject("Codejock.CalendarResource.18.6.0") Resource.SetDataProvider(DataProvider, false) // falso mi assicura che quando faccio destroy non mi chiude il DP Resource.Name = "G" + String(i) // da schedule a risorse scheduleId = Schedules.Item(i - 1).Id Resource.ScheduleIDs.Add(scheduleId) Resources.Add(Resource) NEXT
Calendar.Object.SetMultipleResources(Resources) Calendar.Object.Populate() Calendar.Object.RedrawControl()
DESTROY DataProvider DESTROY Schedules DESTROY Schedule DESTROY Resources DESTROY Resource
|