6.2.3 Creating Calendar views /Domino Designer 6: A Developer’s Handbook/

There are rules that you must follow in order to create a Calendar view. You start the creation like any other view described, but on the View Info tab of the InfoBox you specify Calendar as the style. This tells Domino to display the documents in this view using the Calendar Outline.

Defining columns

You must define the first two columns as described here in order for the view to function properly:


 The first column must be sorted and has to contain a Time/Date value or a list of Time/Date values. Also, make sure that the Show Multiple Values as Separate Entries option is selected in the Sorting tab of the InfoBox for this column. This causes documents containing a Time/Date value list to be displayed on more than one day in the calendar which you can use, for example, for repetitive events. The column may contain dates only, or dates with times, or a mix of the two.

Make this column hidden.


 The value for the second column must evaluate to a duration in minutes, for example (EndDateTime - StartDateTime)/60. If the duration is not relevant for your view, or for the documents being displayed, set the value to zero.

Make this column hidden.

Note: The hide a column in any condition feature has been relocated to the

Advanced tab (in previous releases, it was located at the Column Info tab).

Note: Column headers are not displayed in Calendar views.


Customizing the View layout

Use the Style tab of the View InfoBox to fine-tune your settings. For more information about specifying View style, refer to 6.7.2, “Overview of styles” on page 224.


Figure 6-20 View Properties - Calendar Style tab


For Calendar views, there are extra options in the Style tab to cover all the calendar features. If you select Show conflict marks, a vertical line is displayed in front of entries for appointments which are scheduled for the same time. Furthermore, you might not want to show the selection column in order to save space. The selection column will be shown automatically if there are selected documents in the Calendar view.

Use the Time/Date tab, shown in Figure 6-21 on page 207, to specify the defaults for time slots.


Note: A document marked for deletion will appear with the strike-through

mark.


Figure 6-21 Time/Date tab


A time slot display lists the time of day, along the left edge of the cell, with intervals you specify here. In this example, 8 AM, 9 AM...through 6 PM are displayed for each day. Appointments that occur at a particular time are displayed in the appropriate position.

You may want to build your own columns for displaying the start and end time of

appointments.


Enhancing the functionality of a Calendar view

To allow the user to easily add entries in the Calendar view, consider associating the following LotusScript samples with your view. They allow users to add an appointment by double-clicking in the Date/Time area.

Tip: If you do add start and end time columns, include the entire start date and time, but use time formatting options of the column to display only hours and minutes. This allows Notes to adjust for the user’s local time zone.

If you do not do it this way, users in different time zones may see the same time displayed (for example, they might all see “10:00 AM”) even though the event is not at 10:00 AM in their time zone. Note: The example assumes that the variables ws and ClickedDate are already declared. You must change the commands parameters for your application requirements.


1. Add the following to the Regiondoubleclick event of the view:

Set ws = New NotesUIWorkspace

If source.CalendarDateTime<>"" Then

Call ws.ComposeDocument("", "", "Appointment")

End If

This code detects when the user double-clicks in a calendar cell and creates an “Appointment” document (if you do not want to use the name Appointment”, substitute another name).

You could also add code to this event to fill in a field or fields on the new document with the date and time the user clicked on, or you could do it on the form itself, as described in the next step.


2. Add this LotusScript code to the QueryOpen event of the Appointment form:

Set ws = New NotesUIWorkspace

ClickedDate = ws.CurrentCalendarDateTime

ws.CurrentDocument.Document.ReplaceItemValue(“StartDateTime”, ClickedDate)

ClickedDate is a global variable that is used to set the start date of the new

appointment as default.


206 Domino Designer 6: A Developer’s Handbook