home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / prtrxdem.zip / PRTGRX.VRX < prev    next >
Text File  |  1996-01-01  |  23KB  |  782 lines

  1. /*:VRX         Main
  2. */
  3. /*  Main
  4. */
  5. Main:
  6. /*  Process the arguments.
  7.     Get the parent window.
  8. */
  9.     parse source . calledAs .
  10.     parent = ""
  11.     argCount = arg()
  12.     argOff = 0
  13.     if( calledAs \= "COMMAND" )then do
  14.         if argCount >= 1 then do
  15.             parent = arg(1)
  16.             argCount = argCount - 1
  17.             argOff = 1
  18.         end
  19.     end; else do
  20.         call VROptions 'ImplicitNames'
  21.     end
  22.     InitArgs.0 = argCount
  23.     if( argCount > 0 )then do i = 1 to argCount
  24.         InitArgs.i = arg( i + argOff )
  25.     end
  26.     drop calledAs argCount argOff
  27.  
  28. /*  Load the windows
  29. */
  30.     call VRInit
  31.     parse source . . spec
  32.     _VREPrimaryWindowPath = ,
  33.         VRParseFileName( spec, "dpn" ) || ".VRW"
  34.     _VREPrimaryWindow = ,
  35.         VRLoad( parent, _VREPrimaryWindowPath )
  36.     drop parent spec
  37.     if( _VREPrimaryWindow == "" )then do
  38.         call VRMessage "", "Cannot load window:" VRError(), ,
  39.             "Error!"
  40.         _VREReturnValue = 32000
  41.         signal _VRELeaveMain
  42.     end
  43.  
  44. /*  Process events
  45. */
  46.     call Init
  47.     signal on halt
  48.     do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
  49.         _VREEvent = VREvent()
  50.         interpret _VREEvent
  51.     end
  52. _VREHalt:
  53.     _VREReturnValue = Fini()
  54.     call VRDestroy _VREPrimaryWindow
  55. _VRELeaveMain:
  56.     call VRFini
  57. exit _VREReturnValue
  58.  
  59. VRLoadSecondary:
  60.     __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 )
  61.     if __vrlsWait then do
  62.         call VRFlush
  63.     end
  64.     __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) )
  65.     if __vrlsHWnd = '' then signal __vrlsDone
  66.     if __vrlsWait \= 1 then signal __vrlsDone
  67.     call VRSet __vrlsHWnd, 'WindowMode', 'Modal' 
  68.     __vrlsTmp = __vrlsWindows.0
  69.     if( DataType(__vrlsTmp) \= 'NUM' ) then do
  70.         __vrlsTmp = 1
  71.     end
  72.     else do
  73.         __vrlsTmp = __vrlsTmp + 1
  74.     end
  75.     __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd )
  76.     __vrlsWindows.0 = __vrlsTmp
  77.     do while( VRIsValidObject( VRWindow() ) = 1 )
  78.         __vrlsEvent = VREvent()
  79.         interpret __vrlsEvent
  80.     end
  81.     __vrlsTmp = __vrlsWindows.0
  82.     __vrlsWindows.0 = __vrlsTmp - 1
  83.     call VRWindow __vrlsWindows.__vrlsTmp 
  84.     __vrlsHWnd = ''
  85. __vrlsDone:
  86. return __vrlsHWnd
  87.  
  88. /*:VRX         CB_1_Click
  89. */
  90. CB_1_Click: 
  91.     
  92.     /***** Enable or disable spin buttoms *******************************/
  93.     
  94.     if VRGet( CB_1, 'Set') then do
  95.         call VRSet SPIN_1, 'Enabled', 1
  96.         call VRSet SPIN_4, 'Enabled', 1
  97.     end
  98.     else do
  99.         call VRSet SPIN_1, 'Enabled', 0
  100.         call VRSet SPIN_4, 'Enabled', 0
  101.     end
  102.  
  103. return
  104.  
  105. /*:VRX         Fini
  106. */
  107. Fini:
  108.     window = VRWindow()
  109.     call VRSet window, "Visible", 0
  110.     drop window
  111.     
  112.     /***** Terminate printing environment *******************************/
  113.     
  114.     call PrtGRxTerm prt
  115. return 0
  116.  
  117. /*:VRX         Halt
  118. */
  119. Halt:
  120.     signal _VREHalt
  121. return
  122.  
  123. /*:VRX         idm_about_Click
  124. */
  125. idm_about_Click: 
  126.     ver = PrtGRxVersion();
  127.     wTitle = 'PrtGraph Demo 2/REXX v' || ver
  128.     call aboutwin VRWindow(), wTitle
  129. return
  130.  
  131. /*:VRX         idm_exit_Click
  132. */
  133. idm_exit_Click: 
  134.     call Quit
  135. return
  136.  
  137. /*:VRX         idm_prt_setup_Click
  138. */
  139. idm_prt_setup_Click: 
  140.     
  141.     /***** Call the printers dialog *************************************/
  142.     
  143.     window = VRLoadSecondary( "PrtDialog", "W" )
  144.     
  145.     
  146.     if pName <> '' then do
  147.         ver = PrtGRxVersion();
  148.         wTitle = 'PrtGraph Demo 2/REXX v' || ver '-' pName
  149.         call VRSet Window1, 'Caption', wTitle
  150.     end
  151. return
  152.  
  153. /*:VRX         Init
  154. */
  155. Init:
  156.     
  157.     window = VRWindow()
  158.     call VRMethod window, "CenterWindow"
  159.     
  160.     /***** Load the printing functions if necessary *********************/
  161.     
  162.     if RxFuncQuery( 'PrtGRxLoadFuncs') then
  163.         rcy = RxFuncAdd( 'PrtGRxLoadFuncs', 'PrtGraph', 'PrtGRxLoadFuncs');
  164.     rcy = PrtGRxLoadFuncs();
  165.  
  166. /* 
  167.     if RxFuncQuery( 'TstRxLoadFuncs') then do
  168.         rcy = RxFuncAdd( 'TstRxLoadFuncs', 'ADD_TST', 'TstRxLoadFuncs');
  169.         call TstRxLoadFuncs
  170.     end
  171.  
  172.     call TstRxInit 'PRTGRX', 'E'
  173. */
  174.     /***** Set the title of the window **********************************/
  175.     
  176.     prt = PrtGRxInit( 0);
  177.     
  178.     ver = PrtGRxVersion();
  179.     pName = PrtGRxCurrentPrinter( prt);
  180.     wTitle = 'PrtGraph Demo 2/REXX v' || ver '-' pName
  181.     call VRSet window, 'Caption', wTitle
  182.     
  183.     call VRSet window, "Visible", 1
  184.     call VRMethod window, "Activate"
  185.     
  186.     /***** Initialise the printing environment for the process **********/
  187.     
  188.     /***** Get the path to the OS/2 logo ********************************/
  189.     
  190.     set_path = VALUE( 'PATH', , 'OS2ENVIRONMENT');
  191.     bootdrive = substr( set_path, pos( '\OS2\SYSTEM', set_path ) -2, 2);
  192.     bmp_name = bootdrive || '\os2\bitmap\os2logo.bmp'
  193.     bmp_name2 = bootdrive || '\os2\bitmap\addlogo.bmp'
  194.  
  195.     drop window ver set_path bootdrive
  196.  
  197. return
  198.  
  199. /*:VRX         LB_1_DoubleClick
  200. */
  201. LB_1_DoubleClick: 
  202.     selected = VRGet( "LB_1", "Selected" )
  203.     rcy = PrtGRxSetPrinter( prt, selected)
  204.     pName = VRGet( "LB_1", "SelectedString" )
  205.     call PrtDialog_Close
  206. return
  207.  
  208. /*:VRX         PB_1_Click
  209. */
  210. PB_1_Click: 
  211.     
  212.     /***** Get Page settings ********************************************/
  213.     
  214.     border = VRGet( CB_1, 'Set');
  215.     if border then do
  216.         thick = VRGet( SPIN_1, 'Value');
  217.         style = VRGet( SPIN_4, 'Value');
  218.     end
  219.     else do
  220.         thick = 0;
  221.         style = 0;
  222.     end
  223.     
  224.     /***** Get header settings ******************************************/
  225.     
  226.     header = VRGet( CB_2, 'Set');
  227.     allpages = VRGet( CB_4, 'Set');
  228.     if header then do
  229.         hthick = VRGet( SPIN_2, 'Value');
  230.         hstyle = VRGet( SPIN_3, 'Value');
  231.     end
  232.     else do
  233.         hthick = 0;
  234.         hstyle = 0;
  235.     end
  236.     
  237.     /***** Get footer settings ******************************************/
  238.     
  239.     footer = VRGet( CB_3, 'Set');
  240.     if footer then do
  241.         fthick = VRGet( SPIN_6, 'Value');
  242.         fstyle = VRGet( SPIN_5, 'Value');
  243.     end
  244.     else do
  245.         fthick = 0;
  246.         fstyle = 0;
  247.     end
  248.     
  249.     /***** Get margins for page *****************************************/
  250.     
  251.     lm = VRGet( SPIN_10, 'Value');
  252.     rm = VRGet( SPIN_9, 'Value');
  253.     tm = VRGet( SPIN_8, 'Value');
  254.     bm = VRGet( SPIN_7, 'Value');
  255.     ils = VRGet( SPIN_11, 'Value');
  256.     
  257.     /***** Find what we want to print ***********************************/
  258.     
  259.     if VRGet( RB_1, 'Set') then
  260.         pstyle = 1
  261.     if VRGet( RB_2, 'Set') then
  262.         pstyle = 2
  263.     if VRGet( RB_3, 'Set') then
  264.         pstyle = 3
  265.     if VRGet( RB_4, 'Set') then
  266.         pstyle = 4
  267.     if VRGet( RB_5, 'Set') then
  268.         pstyle = 5
  269.     if VRGet( RB_6, 'Set') then
  270.         pstyle = 6
  271.     if VRGet( RB_7, 'Set') then
  272.         pstyle = 7
  273.     if VRGet( RB_8, 'Set') then
  274.         pstyle = 8
  275.     
  276.     /***** get the font face name ***************************************/
  277.     
  278.     facename = VRGet( EF_1, 'Value');
  279.     if facename = '' then do
  280.         call RxWinAlarm 3
  281.         return
  282.     end
  283.  
  284.     p = pos( '.', facename) + 1;
  285.     facename = substr( facename, p);
  286.  
  287.     call VRSet Window1, 'pointer', 'wait'
  288.  
  289.     /***** Set the margins **********************************************/
  290.     
  291.     rcy = PrtGRxSetMargins( prt, lm, rm, tm, bm, thick, style);
  292.     
  293.     /***** Set the header mode ******************************************/
  294.     
  295.     rcy = PrtGRxSetHeaderMode( prt, header, facename, 10, hstyle, hthick, allpages);
  296.     
  297.     /***** Set the header ***********************************************/
  298.     
  299.     rcy = PrtGRxSetHeader( prt, 3, ,
  300.                            "$cā–Œ", "$lADD Consulting (CH)$r@",,
  301.                            'Demo for PrtGraph Dynamic Link Library for REXX');
  302.     
  303.     /***** Set the footer if any ****************************************/
  304.     
  305.     if footer then do
  306.         rcy = PrtGRxSetFooter( prt, facename, 8, fstyle, fthick, '$ā–Œ$rpage $#');
  307.     end
  308.     
  309.     /***** Open the print job *******************************************/
  310.     
  311.     rcy = PrtGRxOpenPrintJob( prt, 'Test Printing');
  312.  
  313.     /***** Check that everything was ok *********************************/
  314.     
  315.     if \rcy then do
  316.         call VRSet Window1, 'pointer', '<default>'
  317.         return
  318.     end
  319.     
  320.     /***** Set the line spacing for printing ****************************/
  321.     
  322.     rcy = PrtGRxSetLineSpace( prt, ils);
  323.  
  324.     /***** Set the texts for printing ***********************************/
  325.     
  326.     txt1 = 'Hello everyone, this is some text in'
  327.     txt2 = 'point which wraps over several lines.'
  328.     txt3 = 'This is so that you can see how the functions in the graphic printing DLL work.'
  329.     txt4 = 'We hope that you will find them useful.'
  330.     
  331.     select
  332.         
  333.         /***** If left justified text demo ******************************/
  334.         
  335.         when pstyle = 1 then do
  336.             fnt = 8
  337.             rcy = PrtGRxWriteln( prt, facename, fnt, txt1 facename fnt txt2 txt3 txt4);
  338.             rcy = PrtGRxWriteln( prt, , fnt, '');
  339.             do fnt = 10 to 24 by 2
  340.                 rcy = PrtGRxWriteln( prt, , fnt, txt1 facename fnt txt2 txt3 txt4);
  341.                 rcy = PrtGRxWriteln( prt, , fnt, '');
  342.             end
  343.         end
  344.         
  345.         /***** If right justified text demo *****************************/
  346.         
  347.         when pstyle = 2 then do
  348.             fnt = 8
  349.             rcy = PrtGRxJustRight( prt, facename, fnt, txt1 facename fnt txt2 txt3 txt4);
  350.             rcy = PrtGRxWriteln( prt, , fnt, '');
  351.             do fnt = 10 to 24 by 2
  352.                 rcy = PrtGRxJustRight( prt, , fnt, txt1 facename fnt txt2 txt3 txt4);
  353.                 rcy = PrtGRxWriteln( prt, , fnt, '');
  354.             end
  355.         end
  356.         
  357.         /***** If centred text demo *************************************/
  358.         
  359.         when pstyle = 3 then do
  360.             fnt = 8
  361.             rcy = PrtGRxCentre( prt, facename, fnt, txt1 facename fnt txt2 txt3 txt4);
  362.             rcy = PrtGRxWriteln( prt, , fnt, '');
  363.             do fnt = 10 to 24 by 2
  364.                 rcy = PrtGRxCentre( prt, , fnt, txt1 facename fnt txt2 txt3 txt4);
  365.                 rcy = PrtGRxWriteln( prt, , fnt, '');
  366.             end
  367.         end
  368.         
  369.         /***** If justified text demo ***********************************/
  370.         
  371.         when pstyle = 4 then do
  372.             fnt = 8
  373.             rcy = PrtGRxJustified( prt, facename, fnt, txt1 facename fnt txt2 txt3 txt4);
  374.             rcy = PrtGRxWriteln( prt, , fnt, '');
  375.             do fnt = 10 to 24 by 2
  376.                 rcy = PrtGRxJustified( prt, , fnt, txt1 facename fnt txt2 txt3 txt4);
  377.                 rcy = PrtGRxWriteln( prt, , fnt, '');
  378.             end
  379.         end
  380.         
  381.         /***** If print bitmap demo *************************************/
  382.         
  383.         when pstyle = 5 then do
  384.             rcy = PrtGRxWriteln( prt, facename, 14, 'Hello everyone, this is boxed printout of the OS/2 logo');
  385.             rcy = PrtGRxBitMap( prt, bmp_name, 40, 20, 100, 80, 200);
  386.             rcy = PrtGRxBitMap( prt, bmp_name2, 50, 90, 90, 120, 100);
  387.         end
  388.         
  389.         /***** If print table demo **************************************/
  390.         
  391.         when pstyle = 6 then do
  392.             rcy = PrtGRxWriteln( prt, facename, 12, 'Example of printing a table with different styles in each cell');
  393.             rcy = PrtGRxWriteln( prt,,,'');
  394.             rcy = PrtGRxWriteln( prt,,,'Table created with PrtGRxStartTable');
  395.             call WriteTable
  396.  
  397.             rcy = PrtGRxWriteln( prt,facename, 12,'');
  398.             rcy = PrtGRxWriteln( prt, facename, 12, 'Table created with PrtGRxDefineTable');
  399.             rcy = PrtGRxWriteln( prt,facename, 12,'');
  400.             call WriteTable2
  401.         end
  402.         
  403.         /***** If styles demo *******************************************/
  404.         
  405.         when pstyle = 7 then do
  406.             call PrintStyles
  407.         end
  408.         
  409.         /***** If tabbing and goto demo *********************************/
  410.         
  411.         when pstyle = 8 then do
  412.             call PrintTabbedText
  413.         end
  414.  
  415.     end
  416.     
  417.     /***** Close the print job ******************************************/
  418.     
  419.     rcy = PrtGRxClosePrintJob( prt);
  420.  
  421.     call VRSet Window1, 'pointer', '<default>'
  422.  
  423. return
  424.  
  425. /*:VRX         PB_2_Click
  426. */
  427. PB_2_Click: 
  428.     call Quit
  429. return
  430.  
  431. /*:VRX         PB_3_Click
  432. */
  433. PB_3_Click: 
  434.     
  435.     /***** Get the font for printing ************************************/
  436.  
  437.     face = VRGet( EF_1, 'Value')
  438.     p = pos( '.', face)
  439.     if p > 0 then
  440.         face = word( substr( face, p + 1), 1);
  441.     else
  442.         face = ''
  443.     font = PrtGRxFontDlg( prt, 'Choose Font for Printing', face);
  444.     if font <> '' then
  445.         call VRSet EF_1, 'Value', font
  446.  
  447.     drop font face
  448. return
  449.  
  450. /*:VRX         PB_4_Click
  451. */
  452. PB_4_Click: 
  453.     
  454.     /***** Get/Set the job properties for selected printer **************/
  455.     
  456.     rcy = PrtGRxJobProps( prt);
  457. return
  458.  
  459. /*:VRX         PB_5_Click
  460. */
  461. PB_5_Click: 
  462.     call idm_prt_setup_Click
  463. return
  464.  
  465. /*:VRX         PB_6_Click
  466. */
  467. PB_6_Click: 
  468.     call idm_about_Click
  469. return
  470.  
  471. /*:VRX         PB_7_Click
  472. */
  473. PB_7_Click: 
  474.     selected = VRGet( "LB_1", "Selected" )
  475.     if selected > 0 then do
  476.         rcy = PrtGRxSetPrinter( prt, selected)
  477.         pName = VRGet( "LB_1", "SelectedString" )
  478.     end
  479.     call PrtDialog_Close
  480. return
  481.  
  482. /*:VRX         PB_8_Click
  483. */
  484. PB_8_Click: 
  485.     call PrtDialog_Close
  486. return
  487.  
  488. /*:VRX         PrintStyles
  489. */
  490. PrintStyles: 
  491.     
  492.     /***** Get the page size ********************************************/
  493.     
  494.     retstr = PrtGRxGetPageSize( prt);
  495.  
  496.     if retstr = ',' then do
  497.         rcy = VRMessage( VRWindow(), 'Failed to get pagesize', 'ERROR', 'E');
  498.         return;
  499.     end
  500.  
  501.     parse var retstr wide ',' high
  502.     
  503.     /***** Calculate positions for printing *****************************/
  504.     
  505.     vpos1 = trunc( high / 3) * 2;
  506.     vpos2 = trunc( high / 3);
  507.     vinc = trunc( vpos2/ 3);
  508.  
  509.     by1 = vpos1 
  510.     ty1 = vpos1 + vinc
  511.     by2 = vpos2
  512.     ty2 = vpos2 + vinc
  513.  
  514.     hpos = trunc( wide / 8);
  515.     hinc = trunc( hpos / 3) * 2;
  516.  
  517.     bx = 5;
  518.     tx = bx + hinc;
  519.     
  520.     /***** Say what we are printing *************************************/
  521.     
  522.     rcy = PrtGRxWriteln( prt, facename, 10, 'Defined styles for filling');
  523.     
  524.     /***** print a row of boxes with different styles *******************/
  525.     
  526.     do style = 0 to 7
  527.         rcy = PrtGRxBox( prt, bx, by1, tx, ty1, 28, style);
  528.         rcy = PrtGRxGoto( prt, bx, by1 - 10);
  529.         rcy = PrtGRxWrite( prt, facename, 10, 'Style' style);
  530.         bx = bx + hpos;
  531.         tx = tx + hpos;
  532.     end
  533.  
  534.     bx = 5;
  535.     tx = bx + hinc;
  536.     
  537.     /***** print a row of boxes with different styles *******************/
  538.     
  539.     do style = 8 to 15
  540.         rcy = PrtGRxBox( prt, bx, by2, tx, ty2, 28, style);
  541.         rcy = PrtGRxGoto( prt, bx, by2 - 10);
  542.         rcy = PrtGRxWrite( prt, facename, 10, 'Style' style);
  543.         bx = bx + hpos;
  544.         tx = tx + hpos;
  545.     end
  546.  
  547. return
  548.  
  549. /*:VRX         PrintTabbedText
  550. */
  551. PrintTabbedText: 
  552.     
  553.     /***** Get the page size ********************************************/
  554.     
  555.     retstr = PrtGRxGetPageSize( prt);
  556.  
  557.     if retstr = ',' then do
  558.         rcy = VRMessage( VRWindow(), 'Failed to get pagesize', 'ERROR', 'E');
  559.         return;
  560.     end
  561.  
  562.     parse var retstr wide ',' high
  563.     
  564.     /***** Calculate the number of tabs *********************************/
  565.     
  566.     numtabs = trunc( wide / 10) - 1;
  567.     
  568.     /***** Print '|' at each tab position *******************************/
  569.     
  570.     rcy = PrtGrxWriteln( prt, facename, 10, 'Tab positions are shown on the next line');
  571.     rcy = PrtGrxWriteln( prt, , , '');
  572.     rcy = PrtGrxWrite( prt, , , '|');
  573.  
  574.     do i = 1 to numtabs
  575.         rcy = PrtGRxTab( prt);
  576.         rcy = PrtGrxWrite( prt, , , '|');
  577.     end
  578.     
  579.     /***** Go to the bottom of the page *********************************/
  580.     
  581.     rcy = PrtGrxWriteln( prt, , , '');
  582.     rcy = PrtGRxGoto( prt, 0, 10);
  583.     rcy = PrtGRxWrite( prt, , , 'On the next page we show 20 random moves in an area within 200mm of the top margin and right margin');
  584.     rcy = PrtGRxNewPage( prt);
  585.  
  586.     vinc = high - 20;
  587.     hinc = wide - 20;
  588.     
  589.     /***** Do 20 random jumps around the page ***************************/
  590.     
  591.     do i = 1 to 20
  592.         x = random( 5, hinc)
  593.         y = random( 5, vinc)
  594.         rcy = PrtGRxGoto( prt, x, y);
  595.         rcy = PrtGRxWrite( prt,,,'Jump' i x','y);
  596.     end
  597.  
  598. return
  599.  
  600. /*:VRX         PrtDialog_Close
  601. */
  602. PrtDialog_Close: 
  603.     call PrtDialog_Fini
  604. return
  605.  
  606. /*:VRX         PrtDialog_Create
  607. */
  608. PrtDialog_Create: 
  609.     call PrtDialog_Init
  610.     rcy = PrtGRxPrinterList( prt, "printers.");
  611.  
  612.     ok = VRMethod( "LB_1", "Clear" )
  613.     ok = VRMethod( "LB_1", "AddStringList", "printers." )
  614.  
  615.     position = VRMethod( "LB_1", "FindString", pName, 1, "Exact", "Case" )
  616.     call VRSet "LB_1", "Selected", position
  617. return
  618.  
  619. /*:VRX         PrtDialog_Fini
  620. */
  621. PrtDialog_Fini: 
  622.     window = VRInfo( "Window" )
  623.     call VRDestroy window
  624.     drop window
  625. return
  626. /*:VRX         PrtDialog_Init
  627. */
  628. PrtDialog_Init: 
  629.     window = VRInfo( "Object" )
  630.     if( \VRIsChildOf( window, "Notebook" ) ) then do
  631.         call VRMethod window, "CenterWindow"
  632.         call VRSet window, "Visible", 1
  633.         call VRMethod window, "Activate"
  634.     end
  635.     drop window
  636. return
  637.  
  638. /*:VRX         Quit
  639. */
  640. Quit:
  641. /*
  642.     call TstRxStop
  643. */
  644.     window = VRWindow()
  645.     call VRSet window, "Shutdown", 1
  646.     drop window
  647. return
  648.  
  649. /*:VRX         Window1_Close
  650. */
  651. Window1_Close:
  652.     call Quit
  653. return
  654.  
  655. /*:VRX         WriteTable
  656. */
  657. WriteTable: 
  658.     
  659.     /***** Initialise a table *******************************************/
  660.     
  661.     rcy = PrtGRxStartTable( prt, 0, 24, 3,,
  662.                             30,45,,
  663.                             75,50,,
  664.                             125,40);
  665.  
  666.     if rcy then do
  667.         
  668.         /***** Start printing a row *************************************/
  669.         
  670.         rcy = PrtGRxStartRow( prt);
  671.         
  672.         /***** write to col 1 *******************************************/
  673.         
  674.         rcy = PrtGRxStartCol( prt, 1);
  675.         rcy = PrtGRxJustRight( prt, 'Helvetica', 10, 'This is some text in the first column. It is not very long,');
  676.         
  677.         /***** write to col 2 *******************************************/
  678.         
  679.         rcy = PrtGRxStartCol( prt, 2);
  680.         rcy = PrtGRxJustified( prt, 'Helvetica Bold', 10, 'This is some text in the second column. It is not very long,');
  681.         rcy = PrtGRxJustified( prt,,,'This text has several lines and with a bit of luck should force a new page.');
  682.         rcy = PrtGRxJustified( prt,,,'If it does then we have a test of a cell rolling over from one page to the next and we will not have to write any more.');
  683.         
  684.         /***** write to col 3 *******************************************/
  685.         
  686.         rcy = PrtGRxStartCol( prt, 3);
  687.         rcy = PrtGRxCentre( prt, 'Helvetica Bold', 14, 'This is some text in the third column. It is not very long,');
  688.         
  689.         /***** print out the row ****************************************/
  690.         
  691.         rcy = PrtGRxEndRow( prt);
  692.         
  693.         /***** start the next row ***************************************/
  694.         
  695.         rcy = PrtGRxStartRow( prt);
  696.         
  697.         /***** write to col 1 *******************************************/
  698.         
  699.         rcy = PrtGRxStartCol( prt, 1);
  700.         rcy = PrtGRxJustRight( prt, 'Times New Roman', 10, 'This is some text in the first column. It is not very long,');
  701.         
  702.         /***** write to col 2 *******************************************/
  703.         
  704.         rcy = PrtGRxStartCol( prt, 2);
  705.         rcy = PrtGRxWrite( prt, 'Helvetica Bold', 10, 'This is some text in the second column. It is not very long and should be left justified.');
  706.         rcy = PrtGRxCentre( prt,,,'This text has several lines and with a bit of luck should be centred.');
  707.         rcy = PrtGRxJustified( prt,,,'This text here was designed to be justified and should roll over several lines, of course the last line will be left aligned.');
  708.         rcy = PrtGRxJustRight( prt,,,'This last bit of text should finally show all the styles in one cell as it is right aligned.');
  709.         
  710.         /***** write to col 3 *******************************************/
  711.         
  712.         rcy = PrtGRxStartCol( prt, 3);
  713.         rcy = PrtGRxJustified( prt, 'Times New Roman', 8, 'This is some text in the third column. It is not very long,');
  714.         
  715.         /***** print out the row ****************************************/
  716.         
  717.         rcy = PrtGRxEndRow( prt);
  718.         
  719.         /***** Terminate the table **************************************/
  720.         
  721.         rcy = PrtGRxEndTable( prt);
  722.     end
  723.     else
  724.         rcy = PrtGRxWrite( prt, 'Helvetica Bold', 14, 'ERROR - Failed to create the table...');
  725.  
  726. return
  727.  
  728. /*:VRX         WriteTable2
  729. */
  730. WriteTable2: 
  731.  
  732. /***** Define the table ********************************/
  733.  
  734. table.0 = 8
  735. table.1 = 0
  736. table.2 = 14
  737. table.3 = 1
  738. table.4 = 0
  739. table.5 = 28
  740. table.6 = 1
  741. table.7 = 12
  742. table.8 = 'Helvetica Bold'
  743.  
  744. /***** Make 3 columns ***********************************/
  745.  
  746. Cols.0.0 = 3
  747.  
  748. Cols.1.1 = 30
  749. Cols.1.2 = 45
  750. Cols.1.3 = 'Column 1'
  751.  
  752. Cols.2.1 = 75
  753. Cols.2.2 = 50
  754. Cols.2.3 = 'Column 2'
  755.  
  756. Cols.3.1 = 125
  757. Cols.3.2 = 40
  758. Cols.3.3 = 'Column 3'
  759.                        
  760. rcy = PrtGRxDefineTable( prt, "table.", "Cols.");
  761.  
  762. /**** Start printing in the table **********************************/
  763.  
  764. if rcy then do
  765.     do i = 1 to 20
  766.         rcy = PrtGRxStartRow( prt);
  767.         rcy = PrtGRxStartCol( prt, 1)
  768.         rcy = PrtGRxWrite( prt, 'Helvetica Bold', 10, i);
  769.         rcy = PrtGRxStartCol( prt, 2)
  770.         rcy = PrtGRxWrite( prt, 'Helvetica Italic', 10, 'Some italic text');
  771.         rcy = PrtGRxStartCol( prt, 3)
  772.         rcy = PrtGRxWrite( prt, 'Helvetica', 10, random( 20000));
  773.         rcy = PrtGRxEndRow( prt);
  774.     end
  775.     rcy = PrtGRxEndTable( prt);
  776. end    
  777. else
  778.     rcy = PrtGRxWrite( prt, 'Helvetica Bold', 14, 'ERROR - Failed to create the table...');
  779.  
  780. return
  781.  
  782.