Print Page | Close Window

Calendar Deleting an event

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
URL: http://forum.codejock.com/forum_posts.asp?TID=12347
Printed Date: 19 April 2024 at 8:56am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Calendar Deleting an event
Posted By: PPL1
Subject: Calendar Deleting an event
Date Posted: 06 October 2008 at 5:44pm
I'm using the Calendar in a VB6 app.
 
I want to be able to get a notice when an event is deleted and possibly cancel it. There is no Cancel parameter in the EventDeletedEx event. How can this be done? Is BeforeEditOperation the way to go? The problem with the BeforeEditOperation, is that on deleting an event, there is NO reference to the event being deleted... Also, this event seems to occur before the user select to delete "the series" or "just this occurrence" so it is kind of useless for recurring events.
 
Also, I'm experiencing a strange behaviour. If the event is NOT recurring, the event still exist in the database while in the EventDeletedEx event. However, if the event has a recurrence and the user selects to delete all recurrences, the event has already been deleted by the time this event is raised!!! I have extra fields in the Event table used for synchronizing some other data and when the event has recurrences, well I can't get those field values as the record no longer exists.
 
This seems like a bug to me.



Replies:
Posted By: afy65
Date Posted: 12 October 2008 at 11:17am
Ahh! - Had sort of the same problem as you - was checking some custom properties for conflicts and if found cancel the drag/drop, tell the user of the conflict, and then return the event to is original position.
 
There maybe an easier way of doing this but I could find no documentation anywhere - Anyway
 
Declared a temp event variable at the top of the module.
 
Dim TempEvent As CalendarEvent
 
In the calCalendarEvents_BeforeEditOperation event I added the following:
 
If (OpParams.Operation = xtpCalendarEO_DragMove) And (TempEvent Is Nothing) Then
  Set TempEvent = OpParams.DraggingEvent
End If
 
In the calCalendarEvents_EventChanged event I added the following:
 

 
Private Sub calCalendarEvents_EventChanged(ByVal EventID As Long)
    'declare the local variables here
    Dim locEventInfo As CalendarEvent
    Dim locModifiedEvent As CalendarEvent
    Dim locEventID As Integer
    Dim locStartTime As String
    Dim locEndTime As String
    Dim locAllDay As Boolean
    Dim locPersonsName As String
   
    'catch error and pass to the handler
    On Error GoTo errorHandler
   
        Set locEventInfo = calCalendarEvents.DataProvider.GetEvent(EventID)
        Set locModifiedEvent = locEventInfo
   
        locEventID = locEventInfo.id
        locStartTime = locEventInfo.StartTime
        locEndTime = locEventInfo.endTime
        locAllDay = locEventInfo.AllDayEvent
        locPersonsName = locEventInfo.Subject
   
        'check to see if the event conflicts with any other events
        If Not (checkForConflict(locEventID, locStartTime, locEndTime, locAllDay, locPersonsName)) Then
       
            locModifiedEvent.StartTime = TempEvent.StartTime
            locModifiedEvent.endTime = TempEvent.endTime
            locModifiedEvent.AllDayEvent = TempEvent.AllDayEvent
            locModifiedEvent.BusyStatus = TempEvent.BusyStatus
            calCalendarEvents.DataProvider.ChangeEvent locModifiedEvent
            MsgBox "Appointment conflicts with another appointment on your calendar.   ", vbCritical + vbOKOnly, " Conflict...", "", ZERO
       
        End If
       
        'reset the tempEvent holder
        Set TempEvent = Nothing
   
        'all went well so exit sub here
        Exit Sub
'error handler
errorHandler:
   
End Sub
 
 
Hope this helps - should be fairly easy to modify the code so that the user can cancel an event via a prompt instead of a conflict.  If you need more help then drop me a line. ;-)
 
 
 


Posted By: PPL1
Date Posted: 12 October 2008 at 5:20pm
bump



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net