background image
C H A P T E R 1 9
Built-in Applications and System Data
To Do List
19-25
GetToDoItemsForThisDate
returns an array of tasks. Tasks are elements of
the array stored in the
topics
slot of a day's soup entry. For the structure of these
frames, see "To Do List Soup Format" (page 16-77) in Newton Programmer's
Reference
. The following code example obtains today's tasks:
todaysTasksArray := GetRoot().calendar:GetToDo():
GetToDoItemsForThisDate(time());
GetToDoEntry
returns an array of soup entries for a specific day. Since the To
Do List stores tasks in a soup entry for each day, this array will contain an element
for each store that has a task stored under that day. The following code example
obtains today's soup entries:
todaysEntries := GetRoot().calendar:GetToDo():
GetToDoEntry(time(),nil);
Note
The
GetToDoEntry
method requires that the To Do
List be open.
GetToDoItemsForRange
returns an array of frames for each day in the range
passed in. The following code example retrieves the tasks for the next seven days:
nextWeeksTasks := GetRoot().calendar:GetToDo():
GetToDoItemsForRange(time(), time() + 7*24*60);
There is also a To Do List method,
NextToDoDate(
date
),
which returns the
date of the next task on or after date. This method can be useful in this context.
Checking-Off a Task
19
A tasks is marked as completed with the To Do List method
SetDone
. This
method requires the To Do List to be open; you can make sure the To Do List is
open by calling the Dates method
DisplayDate
. The following code sample
marks off a task:
//open Dates and make it show today's To Do List
GetRoot().calendar:Open();
GetRoot().calendar:DisplayDate(time(),'toDoList);
//get a reference to today's tasks
todaysTasksArray := GetRoot().calendar:GetToDo():
GetToDoItemsForThisDate(time());
//find a task that says "test"
for i := 0 to length(todaysTasksArray) - 1 do
if StrEqual (todaysTasksArray[i].text, "test") then
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна