beautypg.com

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

Page 685

background image

C H A P T E R 1 9

Built-in Applications and System Data

Dates

19-11

Adding Meetings or Events

19

You can programmatically add meetings and events by using the

AddAppointment

and

AddEvent

methods. You should use these methods rather

than adding entries in the Dates soups directly.

Here are some examples of adding meetings. Note that the parameters to

AddAppointment are (

mtgText, mtgStartDate

,

mtgDuration

,

repeatPeriod

,

repeatInfo

).

To schedule a one-hour lunch appointment:

GetRoot().calendar:AddAppointment("lunch with Ellen",

StringToDate("6/30/95 11:30am"), 60, nil, nil);

To schedule a twice weekly meeting on Mondays and Wednesdays:

GetRoot().calendar:AddAppointment("design meeting",

StringToDate("11/6/95 10:30am"), 60, 'weekly, [1, 3]);

To schedule a yearly party engagement at New Year’s Eve:

GetRoot().calendar:AddAppointment("New Year’s Eve Party",

StringToDate("12/31/96 9:00pm"), 120, 'yearly, nil);

Here are some examples of adding events; note that the parameters to

AddEvent

are:

(

mtgText, mtgStartDate

,

repeatPeriod

,

repeatInfo

).

To schedule an event:

GetRoot().calendar:AddEvent("buy flowers",

StringToDate("6/30/95"), nil, nil);

To schedule a birthday that repeats yearly:

GetRoot().calendar:AddEvent("George's birthday",

StringToDate("2/22/95"), 'yearly, nil);

To schedule Mother’s Day:

GetRoot().calendar:AddEvent("Mother's Day",

StringToDate("5/14/95"), 'yearlyByWeek, nil);