beautypg.com

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

Page 690

background image

C H A P T E R 1 9

Built-in Applications and System Data

19-16

Dates

Get or set the meeting icon type with

GetMeetingIconType

and

SetMeetingIconType

.

The remainder of this section presents sample code that uses these methods. You
may wish to look at the summary section at the end of this chapter to see what the
parameters to these methods are.

// useful abbreviations

cal

:= GetRoot().calendar;

mtgName

:= "App Design Mtg";

mtgDur :=

60;

startDate

:= StringToDate("2/20/96 12:00pm");

appDueDate := StringToDate("7/23/96 12:00pm");

// schedule a weekly meeting at noon Tuesdays (2/20/96

// falls on a Tuesday)

cal:AddAppointment(mtgName,startDate,mtgDur,'weekly,nil);

// we stop having these meetings when app is due

cal:SetRepeatingEntryStopDate(mtgName,startDate,

appDueDate);

// set a 15-minute advance notice alarm for the meeting

cal:SetEntryAlarm (mtgName, startDate, 15);

// Add an invitee to the meeting. We know that there are

// presently no invitees, since we have just created this

// meeting. But in general, you would add to the present

// list of invitees. Here we add to the (empty) array.

invitees := cal:GetMeetingInvitees(mtgName,startDate);

AddArraySlot(invitees,{name:{first:"Jan",last:"Smith"}});

cal:SetMeetingInvitees(mtgName, startDate, invitees);

// set the location of a meeting to a place not in the

// Names soup

cal:SetMeetingLocation(mtgName, startDate, "Blue Room");

// if the meeting is not in the Blue Room beep

theRoom = cal:GetMeetingLocation(mtgName, startDate)

if not strEqual ("Blue Room", theRoom.company)

then GetRoot():SysBeep();