NS BASIC Tech Note                                     February 12, 1998

How to print Multi Page Reports
--------------------------------------------------------------------------
To do this, you need NS BASIC 3.60m or higher.

The App widget can be used to print using the Newton OS print mechanism.
It prints the contents of the current screen.

When there is more than one page to print, the screen needs to be updated
for each new page to print.

You can do this by creating a routine called printNextPage in your
program. As long as the variable moreToPrint is set to TRUE, the routine
will be called before the next page is printed.

Here's a sample program:


0010  rem print Multiple Pages
0020  LET appSpec={goto:'endProgram,title:"Demo"}
0030  window app,appSpec,"APP"
0040  show app
0050  widgetdef Layout_0:={a:{widgetType:"text",order:0,viewClass:¬
81,viewBounds:{left:67,top:39,right:243,bottom:123},viewFla¬
gs:47616,viewFormat:12625,viewJustify:0,viewLineSpacing:16,¬
text:"Text Box",viewFont:12289,tabs:[20,40,60,80,120,140,16¬
0,180]}}
0060  window wlist,Layout_0
0070  show wlist
1000 mainCode: REM
1010  LET moreToPrint=true
1020  LET i=0
1030  wait -1
8000 printNextPage: rem
8010  setvalue(layout_0.a,'text,"page " & i)
8020  LET i=i+1
8030  if i>3 then moreToPrint=nil
8040  GOTO 1030
9000 endProgram: rem
9010  hide
9020  stop