HOWTO: Identify an Unsaved Event |
Post Reply |
Author | |
DDJJ
Senior Member Joined: 13 December 2004 Status: Offline Points: 143 |
Post Options
Thanks(0)
Posted: 11 October 2006 at 11:24pm |
EXAMPLE: Our app's user opens a form containing the calendar control, selects a time period on the calendar using a mouse, then starts typing a subject for the selected time period.
At this point we want the user to be able to click on a Save button to save the details regarding the selected time period to our database.
The problem is that at this particular point the calendar control has not saved an event. When we check for any events to save(CalendarControl1.DataProvider.GetAllEventsRaw.Count), we get 0.
If the user hits "Enter" after typing whatever, we're OK because the event is saved. The same is true if the user moves off of the unsaved event and clicks somewhere alse on the calendar...the event is then automatically saved.
Two questions. One, how can we test in this kind of situation to see if the user has started to create an event, but didn't complete the action. I was thinking along the lines of comparing the number of saved events (GetAllEventsRaw.Count) to the number of "selections" in the active view...but don't seem to be able to get where I want to get.
Second (probably answered by the answer to the first question)...how would I just automatically save the unsaved event without prompting the user to do so.
Please let me know if this doesn't make sense.
Thanks,
Dan
|
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
Note that after user started typing something, he still can cancel creation of this new event by pressing Esc.
Answer for the first question is to handle BeforeEditOperation notification. There is a special operation type (OpParams.Operation = xtpCalendarEO_InPlaceCreateEvent) which is fired when user started typing. Next event which you can handle is SelectionChanged, and it will contain a pointer to a newly created event (however, note that its subject will still be empty by the end of editing). Your second question about automiatic saving of unsaved event have no answer. After in-place event creation a regular Subject editing is started. This operation do not save each keypress, a subject is changed only after editing is finished (whether by pressing Enter or by clicking outside). -- 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 |