PDA

View Full Version : Calendar Resource



Renato Villa
5-May-2009, 11:53 AM
Hi All

i've a problem with OnComDoUpdateEvent that is not fired when you drag an event in the Calendar Resource.

There is another hook to manipulate an update event.

Thank's

Ian Smith
5-May-2009, 01:53 PM
Hi Renato

The OnComDoUpdateEvent is a data event and is fired when the control needs to save changes to the data for a Calendar Event. I had assumed that this is fired when data changes, but it makes sense that it is not. If it fired whenever a property changed it would be fired several times when a Calendar Event is changed. The firing of this event has to be controlled by some other mechanism, e.g. a timer / idle timer.

The event OnComEventChangedEx gets fired when any of the properties for a Calendar Event are changed. We have not provided a hook for this event, so you will have to code it yourself.

The event is passed a dispatch handle for the Calendar Event, so you will need to link this to a Dataflex object to access the properties. It is safe to use the property Private_phoEvent in this event eg.


Procedure OnComEventChangedEx Variant llpEvent
Handle hoEvent
String sSubject

Get Private_phoEvent to hoEvent
Set pvComObject of hoEvent to llpEvent

Get ComSubject of hoEvent to sSubject
End_ ProcedureYou will need to trap re-entrancy if you are going to change the Calendar Event data in this event.

During the rewrite we will add events to handle OnComEventAddedEx, OnComEventChangedEx and OnComEventDeletedEx. We will pass the event data in a tdEvent structure. These events will handle the re-entrancy issue and allow the Calendar Event data to be changed.

Renato Villa
6-May-2009, 01:54 AM
Thank's Ian

i try it.

Regards

Renato Villa
6-May-2009, 02:35 AM
Hi Ian

i've tested your suggestion and this is what happen.

In a standard calendar if you drag an event first is fired OnComDoUpdateEvent and after is fired OnComEventChangedEx and all work properly (the event change visual position in the calendar.

In a schedules resource calendar the same action only OnComDoCreateEvent is fired and duplicate the event ( original event retain the old position and a new is created)

Thank's

Ian Smith
6-May-2009, 04:01 AM
Hi Renato

I think this is to do with Data Providers. All the OnComDo events use the standard data provider accessed via Private_phoDataProvider. All the examples I have created for multiple resources use a new / different data provider. This is one of the main reasons we are doing a rewrite.

To implement this properly each resource needs its own data provider and the OnComDo events need to establish which data provider should be used.

Renato Villa
6-May-2009, 05:50 AM
Thank's Ian

is possible to deactivate the mouse drag of an event (in the calendar i've deactivated the creation of the event in the Calevent file but you see the new event in the control and disappear when timer send Force_data_refresh).

Regards

Ian Smith
6-May-2009, 07:55 AM
Hi Renato

Again this is not something that we have exposed. The easiest solution is to override the method OnComBeforeEditOperation.

Copy this from the class and add it to your object. Then code
Move True to llbCancelOperation
statements for any of the edit operations that you wish to disable.

E.G.

Case (iOperation = OLExtpCalendarEO_DragMove)
Move True to llbCancelOperation
Case Break

Renato Villa
6-May-2009, 08:18 AM
Thank's again

is what i'm trying and seems to work

Hope your patience is very big.

Regards