Registering without NewtApp

Registering an Auto Part

There is one problem with registering and auto parts, however. With an auto part, the InstallScript is not copied to memory before execution. The problem, then, is to make sure that the dataDef symbol does get copied to memory (we'll use EnsureInternal for that). Here's an example InstallScript and RemoveScript that install and uninstall one dataDef and two viewDefs:

constant kDataDefSym := '|DataDef:Calliope|;
constant kViewDef1Sym := 'default;
constant kViewDef2Sym := 'another;

InstallScript := func(partFrame, removeFrame)
begin
   local dataDefSym :=
      EnsureInternal(kDataDefSym);
   RegDataDef(dataDefSym, GetLayout("dataDef.t"));
   RegisterViewDef(GetLayout("viewDef1.t"),
      dataDefSym);
   RegisterViewDef(GetLayout("viewDef2.t"),
      dataDefSym);
end;

RemoveScript := func(removeFrame)
begin
   UnRegisterViewDef(kViewDef1Sym, kDataDefSym);
   UnRegisterViewDef(kViewDef2Sym, kDataDefSym);
   UnRegDataDef(kDataDefSym);
end

An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.

Last modified: 1 DEC 1996