home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vrpmac21.zip / VRPrHmde.VRM < prev    next >
Text File  |  1995-10-15  |  4KB  |  187 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.     end
  34.     InitArgs.0 = argCount
  35.     if( argCount > 0 )then do i = 1 to argCount
  36.         InitArgs.i = arg( i + argOff )
  37.     end
  38.     drop calledAs argCount argOff
  39.  
  40. /*  Load the windows
  41. */
  42.     call VRInit
  43.     parse source . . spec
  44.     _VREPrimaryWindowPath = ,
  45.         VRParseFileName( spec, "dpn" ) || ".VRW"
  46.     _VREPrimaryWindow = ,
  47.         VRLoad( parent, _VREPrimaryWindowPath )
  48.     drop parent spec
  49.     if( _VREPrimaryWindow == "" )then do
  50.         call VRMessage "", "Cannot load window:" VRError(), ,
  51.             "Error!"
  52.         _VREReturnValue = 32000
  53.         signal _VRELeaveMain
  54.     end
  55.  
  56. /*  Process events
  57. */
  58.     call Init
  59.     signal on halt
  60.     do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
  61.         _VREEvent = VREvent()
  62.         interpret _VREEvent
  63.     end
  64. _VREHalt:
  65.     _VREReturnValue = Fini()
  66.     call VRDestroy _VREPrimaryWindow
  67. _VRELeaveMain:
  68.     call VRFini
  69. exit _VREReturnValue
  70.  
  71. VRLoadSecondary:
  72.     __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 )
  73.     if __vrlsWait then do
  74.         call VRFlush
  75.     end
  76.     __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) )
  77.     if __vrlsHWnd = '' then signal __vrlsDone
  78.     if __vrlsWait \= 1 then signal __vrlsDone
  79.     call VRSet __vrlsHWnd, 'WindowMode', 'Modal' 
  80.     __vrlsTmp = __vrlsWindows.0
  81.     if( DataType(__vrlsTmp) \= 'NUM' ) then do
  82.         __vrlsTmp = 1
  83.     end
  84.     else do
  85.         __vrlsTmp = __vrlsTmp + 1
  86.     end
  87.     __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd )
  88.     __vrlsWindows.0 = __vrlsTmp
  89.     do while( VRIsValidObject( VRWindow() ) = 1 )
  90.         __vrlsEvent = VREvent()
  91.         interpret __vrlsEvent
  92.     end
  93.     __vrlsTmp = __vrlsWindows.0
  94.     __vrlsWindows.0 = __vrlsTmp - 1
  95.     call VRWindow __vrlsWindows.__vrlsTmp 
  96.     __vrlsHWnd = ''
  97. __vrlsDone:
  98. return __vrlsHWnd
  99.  
  100. /*:VRX         dlg_Close
  101. */
  102. dlg_Close:
  103.     call Quit
  104. return
  105.  
  106. /*:VRX         Fini
  107. */
  108. Fini:
  109.     window = VRWindow()
  110.     call VRSet window, "Visible", 0
  111.     drop window
  112. return ret
  113.  
  114. /*:VRX         Halt
  115. */
  116. Halt:
  117.     signal _VREHalt
  118. return
  119.  
  120. /*:VRX         Init
  121. */
  122. Init:
  123.  
  124.     ret = '';
  125.  
  126.     if InitArgs.0 < 2 then
  127.         call Quit;
  128.  
  129.     object = InitArgs.1;
  130.     parse var InitArgs.2 method'_'var1
  131.  
  132.     window = VRWindow()
  133.     call VRSet "DT_1", "Caption", var1
  134.     ok = VRSet( window, "Caption", method )
  135.     call VRMethod window, "CenterWindow"
  136.     call VRSet window, "Visible", 1
  137.     call VRMethod window, "Activate"
  138.     drop window
  139. return
  140.  
  141. /*:VRX         PB_accept_Click
  142. */
  143. PB_accept_Click: 
  144.     font = VRGet( "EF_Font", "Value" )
  145.     pts = VRGet( "SPIN_Pts", "Value" )
  146.     
  147.     set = VRGet( "CB_4", "Set" )
  148.     if set then
  149.         font = '"' || font || '"'
  150.  
  151.     fill = VRGet( "SPIN_fill", "Value");
  152.     line = VRGet( "SPIN_line", "Value");
  153.  
  154.     header = VRGet( "CB_2", "Set" )
  155.     allpages = VRGet( "CB_3", "Set" )
  156.     
  157.     tc = VRGet( "DDCB_tc", "Value");
  158.     if VRMethod( "DDCB_tc", "FindString", tc) > 0 then
  159.         tc = '"' || tc || '"'
  160.     lc = VRGet( "DDCB_lc", "Value");
  161.     if VRMethod( "DDCB_lc", "FindString", lc) > 0 then
  162.         lc = '"' || lc || '"'
  163.     fc = VRGet( "DDCB_fc", "Value");
  164.     if VRMethod( "DDCB_fc", "FindString", fc) > 0 then
  165.         fc = '"' || fc || '"'
  166.  
  167.     ret = 'ok = VRMethod( "' || object || '", "' || method || '",' ,
  168.            header',' font',' pts',' fill',' line',' allpages',' lc',' fc',' tc ");"
  169.     call Quit
  170. return
  171.  
  172. /*:VRX         PB_Cancel_Click
  173. */
  174. PB_Cancel_Click: 
  175.     ret = '';
  176.     call Quit;
  177. return
  178.  
  179. /*:VRX         Quit
  180. */
  181. Quit:
  182.     window = VRWindow()
  183.     call VRSet window, "Shutdown", 1
  184.     drop window
  185. return
  186.  
  187.