![]() |
Possible ID bug when cloning event using mouse |
Post Reply ![]() |
Author | |
zeko78 ![]() Groupie ![]() Joined: 21 August 2006 Location: Norway Status: Offline Points: 11 |
![]() ![]() ![]() ![]() ![]() Posted: 05 September 2006 at 4:21pm |
Hi Serge,
I've discovered some weird behaviour/possible bug.
I'm using a custom dataprovider.
When I clone an event by holding down Ctrl and clicking/dragging an event so that it is "cloned", the new event passed to DoCreateEvent has the same ID as the "old" event. Also the parameter NewEventID contains the id of the old event.
However, if I again clone the newly created event by clicking/dragging it, a new ID is sent to DoCreateEvent (this ID is a totaly new ID, as expected).
So it seems that the first time you clone an event the ID of the original event is passed to DoCreateEvent...
This doesn't look right to me
![]() Best regards,
Gøran
|
|
![]() |
|
sserge ![]() Moderator Group ![]() Joined: 01 December 2004 Status: Offline Points: 1297 |
![]() ![]() ![]() ![]() ![]() |
Hi,
This is not a bug, but a feature ![]() Custom data provider expects that DoCreateEvent() is responsible for assigning proper new event ID value. The ID which is passed to DoCreateEvent is some ID (temporary id or existing event ID). Inside DoCreateEvent you must set unique value to NewEventID. Generally this is AutoKey field from your database. -- WBR, Serge |
|
![]() |
|
zeko78 ![]() Groupie ![]() Joined: 21 August 2006 Location: Norway Status: Offline Points: 11 |
![]() ![]() ![]() ![]() ![]() |
Ok, no bug then
![]() This gives me a nice little problem.
The thing is that we're collection data from various tables to be presented in the calendar. Some data is fetched from a table, added as "temporary" events, and should not be stored in the same table as the events the user creates in the calendar.
Since the "cloned" event sent to DoCreateEvent looks exactly the same as the original (including id, modified time, customproperties and such) I don't know wheter or not this event should be saved...
Is there a way to add an event without triggering DoCreateEvent?
Or, some way to uniquely identify the cloned event (at the time DoCreateEvent is triggered)?
Also, what is the correct place to fetch all my stored events when the Calendar is first opened? My dataprovider is "Provider=custom;Data Source=custom", and I don't find an event which would "ask" me to retreive all stored events to populate the calendar. Instead I do this using CreateEventEx after the dataprovider has been created/opened.
Best regards,
Gøran
|
|
![]() |
|
sserge ![]() Moderator Group ![]() Joined: 01 December 2004 Status: Offline Points: 1297 |
![]() ![]() ![]() ![]() ![]() |
Ok, please take a look into http://codejock.com/support/articles/com/calendar/cp_3.asp
One of the main ideas is not to store all events in calendar,
but to ask them for visible days only: see DoRetrieveDayEvents.
See also our samples about how to implement it.
Do not call DoRetrieveDayEvents for one day many times (this is slow) custom data provider has a cache. DoRetrieveDayEvents called once for each day.
NOTE:
CreateEvent,
CreateEventEx create a new event object related to this data provider.
They are not not add event to storage.
See also AddEvent. But it call
DoCreateEvent, DoUpdateEvent inside
-- WBR, Serge |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |