beautypg.com

Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 812

background image

C H A P T E R 2 2

Transport Interface

22-24

Using the Transport Interface

// vStatus subtype

:SetStatusDialog('Connecting, 'vStatus, "Looking for host...");

// vStatusTitle subtype

:SetStatusDialog('Connecting, 'vStatusTitle, {statusText: "Connecting

to host...", titleText: "Data set 4"});

// vConfirm subtype

:SetStatusDialog('Confirming, 'vConfirm, {statusText: "The host has a

new data set for you. Do you want to receive it now?",

secondary:{text:"Receive Data Set", script: func() ... },

primary:{text:"Disconnect Now", script: func() ... }});

// vProgress subtype

:SetStatusDialog('Sending, 'vProgress, {statusText: "Sending data

set...", titleText: "Data set 4", progress:40});

// vGauge subtype

:SetStatusDialog('Sending, 'vGauge, {statusText: "Sending data

set...", titleText: "Data set 4", gauge:40});

// vBarber subtype

:SetStatusDialog('Sending, 'vBarber, {statusText: "Sending data

set...", titleText:"Data set 4", barber:true});

Once the status view is open, each time you call

SetStatusDialog

, the system

closes and reopens all its child views. This is fairly fast, but if you just want to
update a progress indicator that is already visible in the subtypes

vProgress

,

vGauge

, or

vBarber

, you can use the alternate method

UpdateIndicator

.

This

protoStatusTemplate

method updates the progress indicator child of the

status view: the page image for the

vProgress

subtype, the horizontal bar for the

vGauge

subtype, and animation of the barber pole for the

vBarber

subtype.

For example, you’d use

UpdateIndicator

to update the

vGauge

subtype

as follows:

statusDialog:UpdateIndicator({name:'vGauge, values:{gauge: 50,}});

Note that the frame of data you pass to

UpdateIndicator

consists of two slots,

name

and

values

, that hold the name of the subtype and the value(s) you want to

set, respectively. The

values

slot is specified just like the

values

parameter to

SetStatusDialog

.

Also, note that

UpdateIndicator

is a method of

protoStatusTemplate

,

and you need to send this message to the open status view. A reference to the open
status view is stored in the

statusDialog

slot of the transport frame, so you can

send the message to the value of that slot, as shown above.