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

C H A P T E R 1 9
Built-in Applications and System Data
19-24
To Do List
Also, note that some of these methods only work when the To Do List is open. You
can ensure the To Do List is open by calling the Dates method
DisplayDate
passing in
'toDoList
for the
format
parameter as in the following code:
//open Dates and make it show today’s To Do List
GetRoot().calendar:Open();
GetRoot().calendar:DisplayDate(time(),'toDoList);
This section describes
■
creating and removing To Do tasks
■
accessing tasks
■
checking-off tasks
■
using miscellaneous To Do List methods
■
using the To Do List soup
Creating and Removing Tasks
19
There are two To Do List methods that add a task:
CreateToDoItem
and
CreateToDoItemAll
. The
CreateToDoItem
method takes four parameters, as
in
CreateToDoItem(
date
,
richString
,
reminder
,
frequency
)
. The
CreateToDoItemAll
method takes two additional parameters,
priority
and
completed, which set the priority and completion status of the new task.
The following code example adds a task to today’s To Do List:
GetRoot().calendar:GetToDo():CreateToDoItem (time(),
"test", nil, nil);
The To Do List
GetToDoEntry
method (discussed in “Accessing Tasks” beginning
on page 19-24) will also create a soup entry if one does not exist for that date.
To remove tasks, use the To Do List method
RemoveOldToDoItems
, which
removes either all or those tasks that have been marked-off before a specific date.
The following code sample removes all the nonrepeating To Do List tasks in the
twentieth century:
GetRoot().calendar:GetToDo():
RemoveOldToDoItems(StringToDate("1/1/2000"),'all,nil);
Accessing Tasks
19
The To Do List provides three methods for accessing tasks:
■
GetToDoItemsForThisDate
■
GetToDoEntry
■
GetToDoItemsForRange
.