beautypg.com

Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 688

background image

C H A P T E R 1 9

Built-in Applications and System Data

19-14

Dates

[StringToDate("6/1/95 12:00am"),

StringToDate ("6/30/95 11:59pm")],

nil,

nil);

To find the unique meeting in the month of June with the word “lunch” in the
title or the notes, and handle the possibility of an exception being thrown if this
criterion is not unique:

try

GetRoot().calendar:FindExactlyOneAppointment

(nil,

'["lunch"],

[StringToDate("6/1/95 12:00am"),

StringToDate("6/30/95 11:59pm")],

nil);

onexception |evt.ex| do

if CurrentException().data.errorCode = -48418

then //handle this case

else Rethrow()

The Dates application also provides a method,

FindNextMeeting

, which returns

an array with the meeting start date and duration, for the first meeting after a
specified time. The

FindNextMeeting

method is thus particularly useful for

finding an open time slot in the user’s schedule.

Here is an example, which finds the next meeting after 2

P.M.

on November 1, 1996:

GetRoot().calendar:FindNextMeeting

(StringToDate("11/1/96 2pm"));

Moving Meetings and Events

19

To move an appointment programmatically you employ the

MoveAppointment

method.

Here is an example; note that the parameters to

MoveAppointment

are:

(

mtgText,mtgStartDate,newStartDate,newDuration

)

.

GetRoot().calendar:MoveAppointment(

"Job Review",

StringToDate("9/1/96 9:30am"),

StringToDate("9/8/96 4:00pm"),

nil //do not change duration

);