beautypg.com

Opening a routing slip programmatically 21 – Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 777

background image

C H A P T E R 2 1

Routing Interface

Using Routing

21-29

data. That variable holds the printer selected by the user as the current printer. You
can use this function to obtain the current printer for the item:

item.printer := GetUserConfig('currentPrinter);

If you want to provide a way for the user to select a different printer, you can
use the printer chooser proto,

protoPrinterChooserButton

. This proto

changes the setting of the current printer in the system; it actually changes the

currentPrinter

variable.

If you don’t want to change the current printer in the user’s system, but just want
to let them select a printer for this one print job, then you’ll need to do the
following things:

1. Get and temporarily save the current value of the

currentPrinter

variable in

the user configuration data, using

GetUserConfig

.

2. Display the printer chooser button, allowing the user to select a printer for this

print job. When they select one, the printer chooser proto automatically changes
the

currentPrinter

variable to the chosen one.

3. Retrieve the new value of the

currentPrinter

variable, using

GetUserConfig

, and use that for the

printer

slot in the item frame.

4. Reset the user’s original printer choice by resetting the

currentPrinter

variable in the user configuration data to the value you saved in step 1. To do
this you must use the function

SetUserConfig

.

Opening a Routing Slip Programmatically

21

To open a routing slip programmatically for a transport, use the

OpenRoutingSlip

function. First, create a new item by using the transport’s

NewItem

method; then

add routing information such as the recipient or other information to the new item
frame; and finally, use

OpenRoutingSlip

to open the routing slip for the transport.

Here’s an example of how to do these steps to open a routing slip for the built-in
Call transport:

// opening the Call Transport routing slip

local curs, item, anEntry, class, nameRef;

// get a new item frame from the transport

// '|phoneHome:Newton| identifies the Call transport

item := TransportNotify('|phoneHome:Newton|, 'NewItem, [nil]);

if item = 'noTransport or not item then

return 'noTransport;