Title Banner

Previous Book Contents Book Index Next

Newton Developer Technical Information: Newton Programmer's Guide: 2.1 OS Addendum /
Chapter 1 - Newton Works / Newton Works Interface Reference
Newton Works Viewdef Slots and Methods /


SaveData

viewDef:SaveData(entry)

Called when the current entry is about to be saved to the soup.

entry
The target entry to be saved. Note that the entry could be invalid or read-only; see the discussion.

return value
Return true (if you want the entry saved), nil (if you haven't changed the entry), or the symbol 'NoRealChange (if you want the data saved, but the modification time not updated).

DISCUSSION

If there is data to be saved, modify entry to hold the new or changed data, and return true. Note that if you return nil, the soup entry may still be saved if it has otherwise been modified, for example, by the NewtApp framework. Returning nil does not prevent the entry from being saved, it just notifies Newton Works that you didn't change it.

To save the data but not mark the entry as changed, for example if the hilite location needs to be saved, return the symbol 'NoRealChange, instead of true. This tells Newton Works to save the changes to the soup entry, but not to update the modification time of the entry (as displayed in the title slip).

It is possible for your *SaveData method to be passed an entry that is invalid or read-only. In the *SaveData method, before you do begin any operations that write to the soup entry, you should perform this check:

If EntryValid(entry) and not EntryStore(entry):IsReadOnly()

then // do the operation


Previous Book Contents Book Index Next

© Apple Computer, Inc.
26 APR 1997



Navigation graphic, see text links

Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help