home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vrpmac21.zip / VRPrPDlg.VRM < prev    next >
Text File  |  1995-10-15  |  4KB  |  178 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         Fini
  102. */
  103. Fini:
  104.     window = VRWindow()
  105.     call VRSet window, "Visible", 0
  106.     drop window
  107. return 0
  108.  
  109. /*:VRX         Halt
  110. */
  111. Halt:
  112.     signal _VREHalt
  113. return
  114.  
  115. /*:VRX         Init
  116. */
  117. Init:
  118.     window = VRWindow()
  119.     call VRMethod window, "CenterWindow"
  120.     call VRSet window, "Visible", 1
  121.     call VRMethod window, "Activate"
  122.     drop window
  123. return
  124.  
  125. /*:VRX         PB_accept_Click
  126. */
  127. PB_accept_Click: 
  128.  
  129.     title = VRGet( "EF_Value1", "Value" )
  130.     if VRGet( "CB_1", "Set" ) then
  131.         title = '"' || title || '"'
  132.  
  133.     b1 = VRGet( "EF_Value2", "Value" )
  134.     if VRGet( "CB_2", "Set" ) then
  135.         b1 = '"' || b1 || '"'
  136.  
  137.     b2 = VRGet( "EF_Value3", "Value" )
  138.     if VRGet( "CB_3", "Set" ) then
  139.         b2 = '"' || b2 || '"'
  140.  
  141.     b3 = VRGet( "EF_Value4", "Value" )
  142.     if VRGet( "CB_4", "Set" ) then
  143.         b3 = '"' || b3 || '"'
  144.  
  145.     crlf = "0d0a"x
  146.  
  147.     ret = 'PDButs.0 = 3' || crlf
  148.     ret = ret || 'PDButs.1 =' b1 || crlf
  149.     ret = ret || 'PDButs.2 =' b2 || crlf
  150.     ret = ret || 'PDButs.3 =' b3 || crlf
  151.  
  152.     ret = 'ok = VRMethod( "' || object ||'", "' || method || '",' title', "PDButs.");'
  153.     
  154.     call Quit
  155. return
  156.  
  157. /*:VRX         PB_Cancel_Click
  158. */
  159. PB_Cancel_Click: 
  160.     ret = '';
  161.     call Quit;
  162. return
  163.  
  164. /*:VRX         Quit
  165. */
  166. Quit:
  167.     window = VRWindow()
  168.     call VRSet window, "Shutdown", 1
  169.     drop window
  170. return
  171.  
  172. /*:VRX         VRPrPDlg_Close
  173. */
  174. VRPrPDlg_Close:
  175.     call Quit
  176. return
  177.  
  178.