background image
C H A P T E R 2
Getting Started
Package Loading, Activation, and Deactivation
2-5
when it is moved to another store (it is deactivated then reactivated), or when the
user deletes the application icon in the Extras Drawer. Packages can also be
deactivated without removing them from the store.
When a package is removed as a result of the user deleting it from the Extras
Drawer, the system also executes the
DeletionScript
function in each of the
package frame parts. This occurs before the
RemoveScript
function is executed.
The following sections describe how to use these functions.
Loading
2
The
DoNotInstallScript
function in a package part is executed when a
package is first loaded onto a Newton store from some external source (this does
not include inserting a storage card containing the package or moving it between
stores). This function applies to all types of frame parts (for example, not store parts).
This method gives the parts in the package a chance to prevent installation of the
entire package. If any of the package parts returns a non-
nil
value from this
function, the package is not installed and is discarded.
You should provide the user with some kind of feedback if package installation is
prevented, rather than silently failing. For example, to ensure that a package is
installed only on the internal store you could write a
DoNotInstallScript
function like the following:
func()
begin
if GetStores()[0] <> GetVBOStore(ObjectPkgRef('foo)) then
begin
GetRoot():Notify(kNotifyAlert, kAppName,
"This package was not installed.
It can be installed only onto the internal store.");
true;
end;
end
Activation
2
The
InstallScript
function in a package part is executed when an application
or auto part is activated on the Newton or whenever the Newton is reset.
This function lets you perform any special installation operations that you need to
do, any initialization, and any registration for system services.
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна