Apple Newton Utilities User's Guide Page 765

  • Download
  • Add to my manuals
  • Print
  • Page
    / 942
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 764
CHAPTER 21
Routing Interface
Using Routing 21-17
RegisterViewDef. Nor should you use DefConst, or any other method
that directly references the routing format. This is because the entire
InstallScript function is passed to EnsureInternal (for application parts).
Your routing format layouts would be copied into the NewtonScript heap, wasting
precious memory.
Instead, you should use an indirect method to reference your routing format
layouts. One way is to store a reference to your routing format layouts (by using
GetLayout) in a slot in your application base view (for example,
myRoutingFormat). Then in the InstallScript function, you can reference
that slot through the expression partFrame.theForm.myRoutingFormat.
Because the reference to the layout is found at run time through an argument to
InstallScript, it is not copied into NewtonScript memory by
EnsureInternal when your application is installed.
For example, rst you could store the routing format layout in an application base
view slot:
myRoutingFormat: GetLayout("MyNiceLayout");
Then in the InstallScript function, you could use code like this to register the
format:
InstallScript(partFrame)
begin
local myApp := partFrame.theForm;
...
RegisterViewDef(myApp.myRoutingFormat,
kMyMainDataClassSym);
end;
For more information about view denitions and the functions that act on them,
refer to Chapter 5, “Stationery.
Note
If your application uses the NewtApp framework, registering
routing formats is much easier. The NewtApp framework does it
for you. All you have to do is add your formats to the
allViewDefs frame in the application base view (that is based
on the
newtApplication proto). For more information, see
“Using the Required NewtApp Install and Remove Scripts”
beginning on page 4-21.
Page view 764
1 2 ... 760 761 762 763 764 765 766 767 768 769 770 ... 941 942

Comments to this Manuals

No comments