Receiving Apple Events From the Edition Manager
requires that your application support the required Open Documents event • Section Read events ('sect' 'read')
• Section Write events ('sect' 'writ')
• Section Cancel events ('sect' 'cncl')
• Section Scroll events ('sect' 'scrl')
Each time your application creates a publisher or a subscriber, the
registered subscriber that is set up to receive updated editions automatically,
your application receives a Section Read event.
registering a publisher, it creates a new edition file and sends the publisher a
Section Write event.
When you receive a Section Cancel event, you need to cancel the specified
Section Cancel events, but you do need to provide a handler for future
expansion.
If the user selects a subscriber within a document and then selects the menu
command, Open Publisher in the subscriber options dialog box, the
publishing application receives the Open Documents event and opens the
document containing the publisher. The publishing application also receives a
Section Scroll event. Scroll to the location of the publisher, display this
section on the user's screen, and turn on its border.
information on registering and unregistering a section and writing data to an
publisher and subscriber options.
is registered. It is possible (due to a race condition) to receive an event for a
section that you recently disposed of or un registered. One way to ensure that an
function after you receive an event.
install an event handler to handle Section Read events. You can write similar
code for Section Write events, Section Scroll events, and Section Cancel events.
// Accepting Section Read events and verifying if a section is registered
// Assuming inclusion of
#include <AppleEvents.h>
#include <Editions.h>
// Make sure you place the following call in your initialization code
// sectionReadMsgID , &MyHandleSectionReadEvent,
// This the correct prototype for MyHandleSectionReadEvent
// event arrives.
{
// Prototype user defined functions
//Get section handle out of Apple event message buffer.
getErr = GetSectionHandleFromEvent(theAppleEvent, & sectionH);
if (getErr == noErr) {
//Do nothing if section is not registered.
return DoSectionRead( sectionH);
}
else
return getErr;
}
// The following routine should read in subscriber data and update its
// display.
{
// Your code here.
}
// This is part of your Apple event-handling code.
{
// Parse section handle out of message buffer.
keyDirectObject, // Look for direct object
typeSectionH, // Want a Sectionhandle type
&ignoreType, // Ignore type it could get
(Ptr)& sectionH, // Put SectionHandle here sizeof( sectionH), // size of storage for section handle
&ignoreSize // Ignore storage it used
);
}