http://www.newton-inc.com/dev/techinfo/qa/qa.htm
DoNotInstall
function. This function is called when the package containing the part is activated for the first time as a result of downloading to the unit, putting away to the Extras Drawer, or installation with API functions such as SuckPackageFromBinary
or SuckPackageFromEndpoint
. The function is not called when the package is installed as a result of card insertion, resetting the unit, or moving the package from one store to another using the Extras Drawer filing. This function is incorrectly mentioned in the Newton Programmer's Guide and Newton Programmer's Reference as DoNotInstallScript
. The proper name of the function is simply DoNotInstall
. nil
, the entire package will not be installed on the device. This provides a convenient way to prevent installation on devices that do not support your package. It's considered bad form to simply fail to install and provide no notification to the user. We recommend at least using GetRoot():Notify(...)
to display a message explaining why you are not installing.EnsureInternal
anything this function leaves behind to avoid the "Grip of Death" problems (the error with the alert "The package 'MyApp' still needs the card you removed...").SetPartFrameSlot
. For example, to create a package that will not install on any unit after the year 2000 (because the world will have ended anyway), do the following: SetPartFrameSlot('DoNotInstall, func()
if Time() >= 50492160 then
begin
GetRoot():Notify(kNotifyAlert, "Millenial",
"This application, and all existence, has expired.");
true; // return non-nil to prevent install
end);
InstallScript
will execute in this case, but the part's DoNotInstall
function will not.