beautypg.com

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

Page 811

background image

C H A P T E R 2 2

Transport Interface

Using the Transport Interface

22-23

Using this set of predefined status templates gives all transports a similar user
interface and matches the use of other status views throughout the system.

For more detailed information on

protoStatusTemplate

and the predefined

subtypes, refer to Chapter 17, “Additional System Services.”

Controlling the Status View

22

Your transport should display a status view to the user whenever it is engaged in
a lengthy activity such as sending or receiving data. In general, this means you
must display a status view as part of the processing you do whenever you receive
a

SendRequest

or

ReceiveRequest

message that results in the transmission

of data.

To display a status view, use the transport method

SetStatusDialog

. If the

autoStatus

slot of the transport preferences frame is

true

, the status view

opens automatically when you send the

SetStatusDialog

message with a

status other than

'idle

as the first parameter. If the status view is already open,

SetStatusDialog

updates the status view with the new status information you

pass to it. If

autoStatus

is

nil

, the status view does not open because the user

has set a preference that it not be shown.

Here is an example of how to use the

SetStatusDialog

method:

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

The

SetStatusDialog

method takes three parameters. The first is a symbol

indicating what the new transport status is. This is typically one of the slots in
the

dialogStatusMsgs

frame, such as

'Connecting

, or

'Idle

. The

second parameter is the name of the status subtype you want to use. You can
specify one of the built-in subtypes described in the previous section, or the
name of a custom subtype that you have constructed. (You specify the value of
the

name

slot in the subtype template.) For information on constructing

custom

protoStatusTemplate

view subtypes, see Chapter 17, “Additional

System Services.”

The third parameter is typically a frame that contains one or more slots of values.
Each slot corresponds to a single child view within the subtype you are using, and
it sets the value of that child view. A slot name is the value of the

name

slot in the

child view you are setting, and the value is whatever important value that type of
view uses. The slot names and the expected values for the predefined status
subtypes are listed in the “Important values” column in Table 22-1.

The following examples show how you’d use the

SetStatusDialog

method to

set the different status subtypes to create the status views shown in Figure 22-1.