Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - CalendarEvnt.CustomProperties doesnt work
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CalendarEvnt.CustomProperties doesnt work

 Post Reply Post Reply
Author
Message
dajv View Drop Down
Groupie
Groupie


Joined: 27 July 2004
Location: Australia
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote dajv Quote  Post ReplyReply Direct Link To This Post Topic: CalendarEvnt.CustomProperties doesnt work
    Posted: 14 July 2005 at 4:51pm
(This was previously posted in the ActiveX Suite foruim but SuperMario suggested I post it here.)

The CalendarEvent.CustomProperties collection only seems to work when the event has been added via DataProvider.AddEvent. When an event is added on the calendar ("in place" event creation) I need to save it to the database. I have this code:


Private Sub xtmCalendar_EventAdded(ByVal EventID As Long)
    Dim CalEvent As XtremeCalendarControl.CalendarEvent
    Set CalEvent = xtmCalendar.DataProvider.GetEvent(EventID)
    If Len(CalEvent.CustomProperties("ID")) = 0 Then
        CalEvent.CustomProperties("ID") = 999
    End If
    MsgBox xtmCalendar.DataProvider.GetEvent(EventID).CustomProperties( "ID")

End Sub


Where 999 is assigned would normally be a call to a function to create the event (appointment) in the application database, returning the new id of the appointment.
The CustomProperties collection is updated for the CalEvent object but not for the object in the DataProvider. The last line shows a message box with the "Empty" value of CustomProperties("ID").

This means that Events that are added when the calendar control is initially set up (see below) have a CustomProperties("ID") value, but new events do not.

Here is a small project reproducing it:2005-07-13_170056_CustomProperties.zip

Am I using the DataProvider incorrectly?


Here is the code snippet that sets up the calendar:


frmMyForm.xtmCalendar.DataProvider.RemoveAllEvents

Set rs = GetRecordSet("SELECT SQL THAT GETS APPOINTMENT RECORDS")

Do While Not rs.EOF
     Calendar_AddEvent Val(rs!ID), IIf(Len(NoNull(rs![Subject])) > 0, rs![Subject], "Untitled"), NoNull(rs![Notes]), rs![begin], rs![End], rs!Private, blnMeeting
     Records = Records + 1
     rs.MoveNext
Loop

frmMyForm.xtmCalendar.Populate
frmMyForm.xtmCalendar.RedrawControl
       


And the Calendar_AddEvent() Function:


Public Function Calendar_AddEvent(ID As Long, Subject As String, Description As String, StartDateTime As Date, EndDateTime As Date, _
                             Optional PrivateFlag As Boolean = False, Optional MeetingFlag As Boolean = False, _
                             Optional RecurrenceType As Integer, Optional RecurrenceEndDate As Date) As XtremeCalendarControl.CalendarEvent
    Dim CalEvent As XtremeCalendarControl.CalendarEvent
    Dim CalRecurrence As CalendarRecurrencePattern

    Set CalEvent = frmMyForm.xtmCalendar.DataProvider.CreateEvent()
    If CalEvent Is Nothing Then Exit Function
    CalEvent.StartTime = StartDateTime
    CalEvent.EndTime = EndDateTime

    CalEvent.Subject = Subject
    CalEvent.PrivateFlag = PrivateFlag
    CalEvent.MeetingFlag = MeetingFlag
    CalEvent.BusyStatus = CalendarEventBusyStatus.xtpCalendarBusyStatusBusy
    CalEvent.CustomProperties("ID") = ID

     frmMyForm.xtmCalendar.DataProv ider.A ddEvent CalEvent
    Set Calendar_AddEvent = CalEvent
End Function
       



This is quite important to get resolved, so any prompt advice is appreciated.

Thanks
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 15 July 2005 at 2:04am
Hi,

Thanks -- the problem description is quite complete :)

Thre are 3 basic methods in the data provider to work with events:
    AddEvent()
    ChangeEvent()
    DeleteEvent()

You have just to call ChangeEvent() and event will be updated in the data provider storage.

If Len(CalEvent.CustomProperties("ID")) = 0 Then
    CalEvent.CustomProperties("ID") = 999     
    xtmCalendar.DataProvider.ChangeEvent(CalEvent)
End If


--
WBR,
Serge
Back to Top
dajv View Drop Down
Groupie
Groupie


Joined: 27 July 2004
Location: Australia
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote dajv Quote  Post ReplyReply Direct Link To This Post Posted: 17 July 2005 at 4:50pm
Ah, that makes sense! Thanks alot.
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.172 seconds.