background image
C H A P T E R 1 7
Additional System Services
Using Additional System Services
17-23
And be sure to include this in your application's
ViewQuitScript
to get rid of
the notify icon's action:
if theNotifyIconAction then
begin
GetRoot().notifyIcon:KillAction(theNotifyIconAction);
theNotifyIconAction := nil;
end;
Opening the Status Slip
17
To instantiate a status slip view from its template, pass the template to the
BuildContext
function, as shown in the following code fragment:
statusView := BuildContext(myStatusTemplate);
You should use only the
BuildContext
function to instantiate this template.
Next, you need to initialize the view. If your status view template provided an
initialSetup
slot containing a setup frame, the system uses the frame in this
slot to perform this initialization automatically. Otherwise, you need to set some
initial values for the status view from within its
ViewSetupDoneScript
method. Pass the
ViewSet
method a setup frame, as described in
ViewSet
in
Newton Programmer's Reference.
Once the view has been initialized, send it the
Open
message to display it, as in the
following code fragment:
statusView:Open();
Reporting Progress
17
Once your status slip is open you can perform the task on which you report
progress. You should structure the task to alternate between performing some work
and updating the status slip.
You can use the status slip's
UpdateIndicator
method to update the gauge
view only, as in the following example:
statusView:UpdateIndicator({values:{gauge: 50}});
To update other items in the status slip, you need to use the
ViewSet
method.
Although you can use the
ViewSet
method to initialize all the status slip's
components, you need not always pass all of these values. Once the status slip is
open you need only pass to this method the values to be changed.
statusView:ViewSet({
name: 'vGauge,
values: {statusText: "Waiting for host...",
gauge: 30} // 30% filled
});
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна