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 theRegisterSection
function.
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
TRUE
if 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
TheRegisterSection
function adds the section record to the Edition Manager's list of registered sections and tries to allocate a control block. After calling theRegisterSection
function, thecontrolBlock
field of the section record contains eitherNIL
or a valid control block.For a subscriber, the
controlBlock
field containsNIL
if theRegisterSection
function could not locate the edition container being subscribed to. TheRegisterSection
function then returns either thecontainerNotFoundWrn
or theuserCanceledErr
result code. For a publisher, if theRegisterSection
function 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 theRegisterSection
function could not locate a publisher's corresponding edition container or its volume, thecontrolBlock
field 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 theUnRegisterSection
function, 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
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 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.