Important: The information in this document is obsolete and should not be used for new development.
NewSection
Use theNewSection
function to create a new section record and alias record for a new publisher or subscriber.
FUNCTION NewSection (container: EditionContainerSpec; sectionDocument: FSSpecPtr; kind: SectionType; sectionID: LongInt; initialMode: UpdateMode; VAR sectionH: SectionHandle): OSErr;
container
- The edition you want to publish or subscribe to.
sectionDocument
- The volume reference number, directory ID, and filename of the document that contains a section. The
sectionDocument
parameter can beNIL
if your current document has never been saved. If so, when the user finally saves the document, remember to call theAssociateSection
function for each section to update its alias record.kind
- The type of section (publisher or subscriber) being created.
sectionID
- A unique number for a section within a document. The
NewSection
function initializes thesectionID
field of the new section record with the specified value. Do not use 0 or -1 for an ID number; these numbers are reserved. If your application copies a section, you need to specify a unique number for the copied section.initialMode
- The update mode for the section. For publishers this is either the
pumOnSave
orpumManual
constant, and for subscribers it is eithersumAutomatic
orsumManual
. A subscriber created withsumAutomatic
mode automatically receives a Section Read event. To prevent this initial Section Read event, you should set theinitialMode
parameter tosumManual
and then, whenNewSection
returns, set themode
field of the section record tosumAutomatic
.sectionH
- The
NewSection
function returns a handle to the allocated section record in this parameter. If an error occurs,NewSection
returnsNIL
in this parameter.DESCRIPTION
TheNewSection
function allocates two handles in the current zone: one handle for the section record and another handle for the alias record. Note that you are responsible for unregistering handles created by the Edition Manager.Your application receives the
multiplePublisherWrn
result code if there is another registered publisher to the same edition. Your application receives thenotThePublisherWrn
result code if another publisher (to the same edition) was the last section to write to the edition. ThemultiplePublisherWrn
result code takes priority over thenotThePublisherWrn
result code.RESULT CODES
noErr 0 No error editionMgrInitErr -450 Manager not initialized badSectionErr -451 Not a valid section type badSubPartErr -454 Bad edition container spec multiplePublisherWrn -460 Already is a publisher notThePublisherWrn -463 Not the publisher SEE ALSO
For information on the edition container record, see page 2-71. For information on the section record, see "The Section Record" beginning on page 2-72. For information on file specification records, see Inside Macintosh: Files. See Listing 2-4 on page 2-33 for an example that usesNewSection
to create a publisher and Listing 2-6 on page 2-40 for an example that creates a subscriber usingNewSection
.