home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vrprt21.zip / VRPrTbl2.VRM < prev    next >
Text File  |  1995-10-15  |  8KB  |  305 lines

  1. /* Custom mainline for macro */
  2.  
  3.     signal on SYNTAX name _VRESyntax
  4.     signal _VREMain
  5.  
  6. _VRESyntax:
  7.     parse source . . _VRESourceSpec
  8.     call VRMessage "", "Syntax error in" _VRESourceSpec "line" SIGL":" ErrorText(rc), "Error!"
  9.     call VRFini
  10.     exit 32000
  11.  
  12. _VREMain:
  13. /*:VRX         Main
  14. */
  15. /*  Main
  16. */
  17. Main:
  18. /*  Process the arguments.
  19.     Get the parent window.
  20. */
  21.     parse source . calledAs .
  22.     parent = ""
  23.     argCount = arg()
  24.     argOff = 0
  25.     if( calledAs \= "COMMAND" )then do
  26.         if argCount >= 1 then do
  27.             parent = arg(1)
  28.             argCount = argCount - 1
  29.             argOff = 1
  30.         end
  31.     end; else do
  32.         call VROptions 'ImplicitNames'
  33.         call VROptions 'NoEchoQuit'
  34.     end
  35.     InitArgs.0 = argCount
  36.     if( argCount > 0 )then do i = 1 to argCount
  37.         InitArgs.i = arg( i + argOff )
  38.     end
  39.     drop calledAs argCount argOff
  40.  
  41. /*  Load the windows
  42. */
  43.     call VRInit
  44.     parse source . . spec
  45.     _VREPrimaryWindowPath = ,
  46.         VRParseFileName( spec, "dpn" ) || ".VRW"
  47.     _VREPrimaryWindow = ,
  48.         VRLoad( parent, _VREPrimaryWindowPath )
  49.     drop parent spec
  50.     if( _VREPrimaryWindow == "" )then do
  51.         call VRMessage "", "Cannot load window:" VRError(), ,
  52.             "Error!"
  53.         _VREReturnValue = 32000
  54.         signal _VRELeaveMain
  55.     end
  56.  
  57. /*  Process events
  58. */
  59.     call Init
  60.     signal on halt
  61.     do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
  62.         _VREEvent = VREvent()
  63.         interpret _VREEvent
  64.     end
  65. _VREHalt:
  66.     _VREReturnValue = Fini()
  67.     call VRDestroy _VREPrimaryWindow
  68. _VRELeaveMain:
  69.     call VRFini
  70. exit _VREReturnValue
  71.  
  72. VRLoadSecondary:
  73.     __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 )
  74.     if __vrlsWait then do
  75.         call VRFlush
  76.     end
  77.     __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) )
  78.     if __vrlsHWnd = '' then signal __vrlsDone
  79.     if __vrlsWait \= 1 then signal __vrlsDone
  80.     call VRSet __vrlsHWnd, 'WindowMode', 'Modal' 
  81.     __vrlsTmp = __vrlsWindows.0
  82.     if( DataType(__vrlsTmp) \= 'NUM' ) then do
  83.         __vrlsTmp = 1
  84.     end
  85.     else do
  86.         __vrlsTmp = __vrlsTmp + 1
  87.     end
  88.     __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd )
  89.     __vrlsWindows.0 = __vrlsTmp
  90.     do while( VRIsValidObject( VRWindow() ) = 1 )
  91.         __vrlsEvent = VREvent()
  92.         interpret __vrlsEvent
  93.     end
  94.     __vrlsTmp = __vrlsWindows.0
  95.     __vrlsWindows.0 = __vrlsTmp - 1
  96.     call VRWindow __vrlsWindows.__vrlsTmp 
  97.     __vrlsHWnd = ''
  98. __vrlsDone:
  99. return __vrlsHWnd
  100.  
  101. /*:VRX         CB_2_Click
  102. */
  103. CB_2_Click: 
  104.     set = VRGet( "CB_2", "Set" )
  105.     if \set then do
  106.         ok = VRSet( "DDCB_fc1", "Enabled", 0 )
  107.         ok = VRSet( "DDCB_lc1", "Enabled", 0 )
  108.         ok = VRSet( "DDCB_tc1", "Enabled", 0 )
  109.         ok = VRSet( "SPIN_fill1", "Enabled", 0 )
  110.         ok = VRSet( "SPIN_line1", "Enabled", 0 )
  111.     end
  112.     else do
  113.         ok = VRSet( "DDCB_fc1", "Enabled", 1 )
  114.         ok = VRSet( "DDCB_lc1", "Enabled", 1 )
  115.         ok = VRSet( "DDCB_tc1", "Enabled", 1 )
  116.         ok = VRSet( "SPIN_fill1", "Enabled", 0 )
  117.         ok = VRSet( "SPIN_line1", "Enabled", 0 )
  118.     end
  119.  
  120. return
  121.  
  122. /*:VRX         CB_3_Click
  123. */
  124. CB_3_Click: 
  125.     set = VRGet( "CB_3", "Set" )
  126.     if \set then do
  127.         ok = VRSet( "DDCB_fc", "Enabled", 0 )
  128.         ok = VRSet( "DDCB_lc", "Enabled", 0 )
  129.         ok = VRSet( "DDCB_tc", "Enabled", 0 )
  130.         ok = VRSet( "DDCB_fc1", "Enabled", 0 )
  131.         ok = VRSet( "DDCB_lc1", "Enabled", 0 )
  132.         ok = VRSet( "DDCB_tc1", "Enabled", 0 )
  133.     end
  134.     else do
  135.         ok = VRSet( "DDCB_fc", "Enabled", 1 )
  136.         ok = VRSet( "DDCB_lc", "Enabled", 1 )
  137.         ok = VRSet( "DDCB_tc", "Enabled", 1 )
  138.         ok = VRSet( "DDCB_fc1", "Enabled", 1 )
  139.         ok = VRSet( "DDCB_lc1", "Enabled", 1 )
  140.         ok = VRSet( "DDCB_tc1", "Enabled", 1 )
  141.     end
  142. return
  143.  
  144. /*:VRX         Fini
  145. */
  146. Fini:
  147.     window = VRWindow()
  148.     call VRSet window, "Visible", 0
  149.     drop window
  150. return ret
  151.  
  152. /*:VRX         Halt
  153. */
  154. Halt:
  155.     signal _VREHalt
  156. return
  157.  
  158. /*:VRX         Init
  159. */
  160. Init:
  161.     ret = '';
  162.  
  163.     if InitArgs.0 < 2 then
  164.         call Quit;
  165.  
  166.     object = InitArgs.1;
  167.     method = InitArgs.2;
  168.  
  169.     window = VRWindow()
  170.     ok = VRSet( window, "Caption", method )
  171.     call VRMethod window, "CenterWindow"
  172.     call VRSet window, "Visible", 1
  173.     call VRMethod window, "Activate"
  174.     drop window
  175.  
  176. return
  177.  
  178. /*:VRX         PB_accept_Click
  179. */
  180. PB_accept_Click: 
  181.     crlf = "0d0a"x
  182.     left = VRGet( "SPIN_left", "Value");
  183.     cols = VRGet( "SPIN_cols", "Value");
  184.     fill = VRGet( "SPIN_fill", "Value");
  185.     line = VRGet( "SPIN_line", "Value");
  186.     hfill = VRGet( "SPIN_fill1", "Value");
  187.     hline = VRGet( "SPIN_line1", "Value");
  188.     widths = VRGet( "EF_widths", "Value");
  189.     headers = VRGet( "EF_headers", "Value");
  190.     pts = VRGet( "SPIN_Pts", "Value");
  191.     font = VRGet( "EF_font", "Value");
  192.     set = VRGet( "CB_4", "Set");
  193.     if set then
  194.         font = '"' || font || '"'
  195.  
  196.     wide.0 = cols;
  197.     do i = 1 to cols
  198.         wide.i = 0;
  199.     end
  200.     txt.0 = cols;
  201.     do i = 1 to cols
  202.         txt.i = '';
  203.     end
  204.  
  205.     hdr = VRGet( "CB_2", "Set");
  206.     all = VRGet( "CB_1", "Set");
  207.     clr = VRGet( "CB_3", "Set");
  208.     if clr then do
  209.         tc = VRGet( "DDCB_tc", "Value");
  210.         if VRMethod( "DDCB_tc", "FindString", tc) > 0 then
  211.             tc = '"' || tc || '"'
  212.         lc = VRGet( "DDCB_lc", "Value");
  213.         if VRMethod( "DDCB_lc", "FindString", lc) > 0 then
  214.             lc = '"' || lc || '"'
  215.         fc = VRGet( "DDCB_fc", "Value");
  216.         if VRMethod( "DDCB_fc", "FindString", fc) > 0 then
  217.             fc = '"' || fc || '"'
  218.         htc = VRGet( "DDCB_tc1", "Value");
  219.         if VRMethod( "DDCB_tc1", "FindString", htc) > 0 then
  220.             htc = '"' || htc || '"'
  221.         hlc = VRGet( "DDCB_lc1", "Value");
  222.         if VRMethod( "DDCB_lc1", "FindString", hlc) > 0 then
  223.             hlc = '"' || hlc || '"'
  224.         hfc = VRGet( "DDCB_fc1", "Value");
  225.         if VRMethod( "DDCB_fc1", "FindString", hfc) > 0 then
  226.             hfc = '"' || hfc || '"'
  227.         ret = "table.0 = 15" || crlf
  228.     end
  229.     else
  230.         ret = "table.0 = 9" || crlf
  231.  
  232.     ret = ret || "table.1 =" fill || crlf
  233.     ret = ret || "table.2 =" line || crlf
  234.     ret = ret || "table.3 =" hdr || crlf
  235.     ret = ret || "table.4 =" hfill || crlf
  236.     ret = ret || "table.5 =" hline || crlf
  237.     ret = ret || "table.6 =" all || crlf
  238.     ret = ret || "table.7 =" pts || crlf
  239.     ret = ret || "table.8 =" font || crlf
  240.     ret = ret || "table.9 =" left || crlf
  241.  
  242.     if clr then do
  243.         ret = ret || "table.10 =" tc || crlf
  244.         ret = ret || "table.11 =" lc || crlf
  245.         ret = ret || "table.12 =" fc || crlf
  246.         ret = ret || "table.13 =" htc || crlf
  247.         ret = ret || "table.14 =" hlc || crlf
  248.         ret = ret || "table.15 =" hfc || crlf || crlf
  249.     end
  250.  
  251.     ret = ret || "Cols.0.0 =" cols || crlf || crlf
  252.  
  253.     p = pos( ',', widths);
  254.     i = 1;
  255.     do while( p > 0)
  256.         wide.i = substr( widths, 1, p - 1);
  257.         widths = substr( widths, p + 1);
  258.         p = pos( ',', widths);
  259.         i = i + 1;
  260.     end
  261.     wide.i = widths;
  262.     
  263.     p = pos( ',', headers);
  264.     i = 1;
  265.     do while( p > 0)
  266.         txt.i = substr( headers, 1, p - 1);
  267.         headers = substr( headers, p + 1);
  268.         p = pos( ',', headers);
  269.         i = i + 1;
  270.     end
  271.     txt.i = headers;
  272.     
  273.     do i = 1 to cols
  274.         ret = ret || "Cols." || i || ".1 =" wide.i || crlf
  275.         ret = ret || "Cols." || i || ".2 =" txt.i || crlf
  276.         ret = ret || crlf
  277.     end
  278.  
  279.     ret = ret || 'ok = VRMethod( "' || object ||'", "' || method || '", "table.", "cols.");'
  280.     call Quit
  281.  
  282. return
  283.  
  284. /*:VRX         PB_Cancel_Click
  285. */
  286. PB_Cancel_Click: 
  287.     ret = '';
  288.     call Quit;
  289. return
  290.  
  291. /*:VRX         Quit
  292. */
  293. Quit:
  294.     window = VRWindow()
  295.     call VRSet window, "Shutdown", 1
  296.     drop window
  297. return
  298.  
  299. /*:VRX         VRPrTbl2_Close
  300. */
  301. VRPrTbl2_Close:
  302.     call Quit
  303. return
  304.  
  305.