Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Interapplication Communication /
Chapter 2 - Edition Manager / Edition Manager Reference
Edition Manager Routines / Creating and Registering a Section


NewSection

Use the NewSection 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 be NIL if your current document has never been saved. If so, when the user finally saves the document, remember to call the AssociateSection 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 the sectionID 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 or pumManual constant, and for subscribers it is either sumAutomatic or sumManual. A subscriber created with sumAutomatic mode automatically receives a Section Read event. To prevent this initial Section Read event, you should set the initialMode parameter to sumManual and then, when NewSection returns, set the mode field of the section record to sumAutomatic.
sectionH
The NewSection function returns a handle to the allocated section record in this parameter. If an error occurs, NewSection returns NIL in this parameter.
DESCRIPTION
The NewSection 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 the notThePublisherWrn result code if another publisher (to the same edition) was the last section to write to the edition. The multiplePublisherWrn result code takes priority over the notThePublisherWrn result code.

RESULT CODES
noErr0No error
editionMgrInitErr-450Manager not initialized
badSectionErr-451Not a valid section type
badSubPartErr-454Bad edition container spec
multiplePublisherWrn-460Already is a publisher
notThePublisherWrn-463Not 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 uses NewSection to create a publisher and Listing 2-6 on page 2-40 for an example that creates a subscriber using NewSection.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996