background image
C H A P T E R 1 7
Additional System Services
Using Additional System Services
17-25
Registering Login Screen Functions
17
If you want a power-on function that brings up some sort of visible component,
you should register that function as login function. These functions are only called
after the login screen has been displayed and the password entered (if the user has
installed a password). Note that future Newton devices may not support the login
screen. In this case the login functions will still be executed.
The methods that register login functions are defined in the
sleepScreen view
,
to get a reference to the
sleepScreen
view to send it
RegLogin
and
UnRegLogin
messages, use code such as:
GetRoot().sleepScreen:RegLogin(callBackFn,callBackFnArgs);
IMPORTANT
The callback function registered with
RegLogin
must not itself
call
RegLogin
nor
UnRegLogin
.
Registering Power-Off Functions
17
You may register callback functions to be called when a Newton device is powered
off with the
RegPowerOff
function. As with power-on functions, when the
Newton is powered off, the system passes a symbol to your "shutdown" callback
function indicating the reason it was called. This symbol, passed as the value of
your callback's why parameter, allows it to condition its actions according to the
way the system was powered off. The
'user
symbol indicates that the user
initiated the shutdown. The
'idle
symbol indicates the system initiated shutdown
after the Newton was left idle for the period of time specified by the user's Sleep
preferences. The
'because
symbol indicates that the Newton powered off for
some other unspecified reason.
The system also passes a symbol to your callback function indicating the current
status of the shutdown operation. This symbol is passed as the value of your
callback's what parameter. The value of this parameter is used as the basis for
the cooperative shutdown process. Your callback function must return a value
indicating whether to continue the power-off sequence or delay it. This value is
passed to all registered shutdown functions, allowing each to indicate whether it is
ready to shut down or needs time to complete a task.
The
'okToPowerOff
symbol indicates that the system has received a request to
shut down. In response to the
'okToPowerOff
symbol, your callback can return
true
to specify that shutdown may continue, or it can return
nil
to cancel the
shutdown process. Note that an
'okToPowerOff
symbol does not guarantee that
shutdown will occur--another callback function may cancel the power-off sequence.
The
'powerOff
symbol indicates that shutdown is imminent. If the callback
function must first perform an operation asynchronously, such as the disposal of a
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна