Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - Code not working on PowerBuilder
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Code not working on PowerBuilder

 Post Reply Post Reply
Author
Message
ADBJ View Drop Down
Newbie
Newbie


Joined: 13 July 2021
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote ADBJ Quote  Post ReplyReply Direct Link To This Post Topic: Code not working on PowerBuilder
    Posted: 13 July 2021 at 6:11am
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

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

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

This page was generated in 0.125 seconds.