Print Page | Close Window

Code not working on PowerBuilder

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
Printed Date: 19 August 2022 at 10:53am
Software Version: Web Wiz Forums 12.04 -

Topic: Code not working on PowerBuilder
Posted By: ADBJ
Subject: Code not working on PowerBuilder
Date Posted: 13 July 2021 at 6:11am
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))

// 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

// ******************
// ******************
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 &

Resources = CREATE OLEObject
Resource = CREATE OLEObject

Schedules = DataProvider.Schedules

// Inserisco risorse
Integer i
Long scheduleId
FOR i = 1 TO 3
    Schedules.AddNewSchedule("G" + String(i))
    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


DESTROY DataProvider
DESTROY Schedules
DESTROY Schedule
DESTROY Resources
DESTROY Resource

Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 -
Copyright ©2001-2021 Web Wiz Ltd. -