Important: The information in this document is obsolete and should not be used for new development.
RegisterSection
When opening a document that contains sections, register each section using theRegisterSectionfunction.
FUNCTION RegisterSection (sectionDocument: FSSpec; sectionH: SectionHandle; VAR aliasWasUpdated: Boolean): OSErr;
sectionDocument- The volume reference number, directory ID, and filename of the document that contains a section.
sectionH- A handle to the section record for a given section.
aliasWasUpdated- A Boolean value that returns
TRUEif the alias for the edition container subscribed to was out of date and was updated. This may occur if the edition file was moved to a new location or was renamed.DESCRIPTION
TheRegisterSectionfunction adds the section record to the Edition Manager's list of registered sections and tries to allocate a control block. After calling theRegisterSectionfunction, thecontrolBlockfield of the section record contains eitherNILor a valid control block.For a subscriber, the
controlBlockfield containsNILif theRegisterSectionfunction could not locate the edition container being subscribed to. TheRegisterSectionfunction then returns either thecontainerNotFoundWrnor theuserCanceledErrresult code. For a publisher, if theRegisterSectionfunction could not locate its corresponding edition container, the Edition Manager creates an edition container in the last place the edition was located and creates a control block for it. If theRegisterSectionfunction could not locate a publisher's corresponding edition container or its volume, thecontrolBlockfield containsNIL. You should never re-register a section that is already registered.Note that you can compare control blocks for individual sections. If two sections contain the same control block value, these sections publish or subscribe to the same edition (unless the control block is
NIL). The Edition Manager keeps track of how many sections are referencing a control block to know when it can be deallocated. The control block maintains a count of how many sections are referencing it. Each time you use theUnRegisterSectionfunction, the control block subtracts 1 from the number of sections. When the number of sections reaches 0, the control block is deallocated.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 userCanceledErr -128 User clicked Cancel in dialog box editionMgrInitErr -450 Manager not initialized badSectionErr -451 Not valid section type multiplePublisherWrn -460 Already is a publisher containerNotFoundWrn -461 Alias was not resolved notThePublisherWrn -463 Not the publisher SEE ALSO
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. For additional information and an example of the use ofRegisterSection, see "Opening and Closing a Document Containing Sections" beginning on page 2-22.