background image
C H A P T E R 2 1
Routing Interface
21-16
Using Routing
If you need to read the
body
slot within the
fields
frame, note that it might
contain an alias. In order to access it you must get the format and send it the
ResolveBody
message, like this:
theFormat := GetCurrentFormat(fields);
resolvedBodySlot := theFormat:ResolveBody(fields);
The
ResolveBody
method returns the data in the
body
slot whether or not it is
referenced by an alias, so you can always use it.
You can store information you obtain from an auxiliary view in the
fields
frame,
preferably in the
body
slot (or if
body
contains an alias, in the entry the alias
points to). If you store data from the auxiliary view in a different slot, be sure the
slot name has your developer signature appended to avoid future slot name
conflicts.
Registering Routing Formats
21
All routing formats are specified as view definitions and are registered with the
system by means of the global function
RegisterViewDef
. The formats that
handle data types other than
'view
are not actually views, but they are registered
as view definitions to take advantage of the central registration mechanism.
Registering formats in this way makes them available to all applications in the
system. Routing formats are specially identified in the view definition registry
because the
type
slot of all routing formats is set to the symbol
'routeFormat
(or
'printFormat
in some ROM versions).
Register formats with the class of the object you want them to act on. Here is an
example of registering a format:
RegisterViewDef(myPrintFormat, '|myDataClass:SIG|);
This call registers the format
myPrintFormat
as working with data whose
class is
'|myDataClass:SIG|
. If the class of any target data object is
'|myDataClass:SIG|
, the format
myPrintFormat
will be available when
that item is routed. The fact that this print format (with a
'view
data type) has
been registered means that you can print and fax that class of data items. This
mechanism enables you to have separate routing formats (and thus routing actions)
for individual views, if they use different data classes for data, rather than using the
same formats (and routing actions) for all views in an application.
Typically, your application registers routing formats when it is installed, in its part
InstallScript
function, and unregisters formats in its
RemoveScript
function. You use the function
UnRegisterViewDef
to unregister routing formats.
In an application part
InstallScript
function, when registering your
routing formats, you must not use the Newton Toolkit function
GetLayout
to obtain a reference to the routing format layout, so that you can pass it to
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна