Registering without NewtApp
InstallScript
is copied to memory before execution. Because of this, it is important not to call GetLayout
from within the InstallScript
. If you were to do that, the entire dataDef and viewDef would be copied to the frame heap (egad, what a memory-sucking monster that would be!). Instead, you should save your dataDefs and viewDefs as slots in your application base template and then refer to those slots from within your InstallScript
. Here's an example InstallScript
and RemoveScript
which install and uninstall one dataDef and two viewDefs:
constant kDataDefSym := '|DataDef:Calliope|; constant kViewDef1Sym := 'default; constant kViewDef2Sym := 'another; InstallScript := func(partFrame) begin local base := partFrame.theForm; // assumes we've created three slots: // dataDef, viewDef1, and viewDef2 // in the base template. They should have // been initialized with GetLayout. RegDataDef(kDataDefSym, base.dataDef); RegisterViewDef(base.viewDef1, kDataDefSym); RegisterViewDef(base.viewDef2, kDataDefSym); end; RemoveScript := func(partFrame) 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