Print Page | Close Window

HOWTO: Identify an Unsaved 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=5274
Printed Date: 16 November 2024 at 10:44am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: HOWTO: Identify an Unsaved Event
Posted By: DDJJ
Subject: HOWTO: Identify an Unsaved Event
Date 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
 



Replies:
Posted By: sserge
Date Posted: 12 October 2006 at 4:30am
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



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