Important: The information in this document is obsolete and should not be used for new development.
NewSection
Use theNewSectionfunction 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
sectionDocumentparameter can beNILif your current document has never been saved. If so, when the user finally saves the document, remember to call theAssociateSectionfunction 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
NewSectionfunction initializes thesectionIDfield 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
pumOnSaveorpumManualconstant, and for subscribers it is eithersumAutomaticorsumManual. A subscriber created withsumAutomaticmode automatically receives a Section Read event. To prevent this initial Section Read event, you should set theinitialModeparameter tosumManualand then, whenNewSectionreturns, set themodefield of the section record tosumAutomatic.sectionH- The
NewSectionfunction returns a handle to the allocated section record in this parameter. If an error occurs,NewSectionreturnsNILin this parameter.DESCRIPTION
TheNewSectionfunction 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
multiplePublisherWrnresult code if there is another registered publisher to the same edition. Your application receives thenotThePublisherWrnresult code if another publisher (to the same edition) was the last section to write to the edition. ThemultiplePublisherWrnresult code takes priority over thenotThePublisherWrnresult 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 usesNewSectionto create a publisher and Listing 2-6 on page 2-40 for an example that creates a subscriber usingNewSection.