home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR24 / CLASSEDI.ZIP / CLASSSRC.ZIP / WINDOW1.VRX < prev    next >
Text File  |  1993-08-07  |  5KB  |  245 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
  20.     InitArgs.0 = argCount
  21.     if( argCount > 0 )then do i = 1 to argCount
  22.         InitArgs.i = arg( i + argOff )
  23.     end
  24.     drop calledAs argCount argOff
  25. /* 
  26.     user init 
  27. */
  28.     call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
  29.     call SysLoadFuncs
  30.  
  31.     registerwindow_id = 0 /* global variable */
  32.     aboutwindow_id = 0 /* global variable */
  33.  
  34. /*  Load the windows
  35. */
  36.     call VRInit
  37.     parse source . . spec
  38.     _VREPrimaryWindowPath = ,
  39.         VRParseFileName( spec, "dpn" ) || ".VRW"
  40.     _VREPrimaryWindow = ,
  41.         VRLoad( parent, _VREPrimaryWindowPath )
  42.     drop parent spec
  43.     if( _VREPrimaryWindow == "" )then do
  44.         call VRMessage "", "Cannot load window:" VRError(), ,
  45.             "Error!"
  46.         _VREReturnValue = 32000
  47.         signal _VRELeaveMain
  48.     end
  49.  
  50.     call listclasses
  51.  
  52. /*  Process events
  53. */
  54.     call Init
  55.     signal on halt
  56.     do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
  57.         _VREEvent = VREvent()
  58.         interpret _VREEvent
  59.     end
  60. _VREHalt:
  61.     _VREReturnValue = Fini()
  62.     call VRDestroy _VREPrimaryWindow
  63. _VRELeaveMain:
  64.     call VRFini
  65. exit _VREReturnValue
  66.  
  67. VRLoadSecondary: procedure
  68.     name = arg( 1 )
  69.  
  70.     window = VRLoad( VRWindow(), VRWindowPath(), name )
  71.     call VRMethod window, "CenterWindow"
  72.     call VRSet window, "Visible", 1
  73.     call VRMethod window, "Activate"
  74. return window
  75.  
  76. /*:VRX         About_Close
  77. */
  78. About_Close:
  79.     window = VRInfo( "Object" )
  80.     call VRDestroy window
  81.     drop window
  82. return
  83. /*:VRX         Fini
  84. */
  85. Fini:
  86.     window = VRWindow()
  87.     call VRSet window, "Visible", 0
  88.     drop window
  89. return 0
  90.  
  91. /*:VRX         Halt
  92. */
  93. Halt:
  94.     signal _VREHalt
  95. return
  96.  
  97. /*:VRX         Init
  98. */
  99. Init:
  100.     window = VRWindow()
  101.     call VRMethod window, "CenterWindow"
  102.     call VRSet window, "Visible", 1
  103.     call VRMethod window, "Activate"
  104.     drop window
  105. return
  106.  
  107. /*:VRX         listclasses
  108. */
  109. listclasses:
  110.     call SysQueryClassList "classes."
  111.     ret = VRMethod("lista","Reset");
  112.     ret = VRMethod("lista","AddStringList","classes.");
  113.     drop classes.
  114.     drop ret
  115. return
  116.  
  117. /*:VRX         PB_10_Click
  118. */
  119. PB_10_Click:
  120.     ok = VRDestroy(aboutwindow_id)
  121. return
  122.  
  123. /*:VRX         PB_1_Click
  124. */
  125. PB_1_Click:
  126.     call listclasses
  127. return
  128.  
  129. /*:VRX         PB_2_Click
  130. */
  131. PB_2_Click:
  132.     classname = word(VRGet("lista","SelectedString"),1)
  133.  
  134.     buttons.0=1
  135.     buttons.1="OK"
  136.     
  137.     if length(classname)>0 then 
  138.     do
  139.         if SysCreateObject(classname,classname,"<WP_DESKTOP>") then 
  140.               ret= VRMessage("lista"," Success","","I","buttons.",1,)
  141.         else  ret= VRMessage("lista"," Failure","","E","buttons.",1,)
  142.     end
  143.     drop buttons.
  144. return
  145.  
  146. /*:VRX         PB_3_Click
  147. */
  148. PB_3_Click:
  149.  
  150.     classname = word(VRGet("lista","SelectedString"),1)
  151.  
  152.     buttons.0=2
  153.     buttons.1="YES"
  154.     buttons.2="NO"
  155.     
  156.     ret = VRMessage("Object","Destroy " || classname ,"","Q","buttons.",2,,)
  157.     if ret = 2 then return
  158.  
  159.     ret = SysDeregisterObjectClass(classname)
  160.  
  161.     call listclasses
  162. return
  163.  
  164. /*:VRX         PB_4_Click
  165. */
  166. PB_4_Click:
  167.     registerwindow_id = VRLoadSecondary(RegisterWindow)
  168. return
  169.  
  170. /*:VRX         PB_5_Click
  171. */
  172. PB_5_Click:
  173.     ok = VRDestroy(registerwindow_id)
  174. return
  175.  
  176. /*:VRX         PB_6_Click
  177. */
  178. PB_6_Click:
  179.  
  180.     filename = VRFileDialog("Object","","O","c:\","",,)
  181.     call VRSet "DLL_NAME","Value",filename
  182.  
  183. return
  184.  
  185. /*:VRX         PB_7_Click
  186. */
  187. PB_7_Click:
  188.     dlldir    = VRGet("DLL_DIRECTORY","Value")
  189.     if length(dlldir)=0 then return
  190.     dllname   = VRGet("DLL_NAME","Value")
  191.     if length(dllname)=0 then return
  192.     classname = VRGet("CLASS_NAME","Value")
  193.     if length(classname)=0 then return    
  194.  
  195.     buttons.0=1
  196.     buttons.1="OK"
  197.     
  198.     destination = dlldir || "\*.*"
  199.     /* copia del file nella directory dll */
  200.     ok = VRCopyFile(dllname,destination)
  201.     if ok = 0 then ret= VRMessage("lista"," Failure in copying dll ","","E","buttons.",1,)
  202.  
  203.     name = substr(dllname,lastpos("\",dllname)+1)  
  204.  
  205.     ok = SysRegisterObjectClass(classname,substr(name,1,lastpos(".",name)-1))
  206.     if ok = 0 then ret= VRMessage("lista"," Failure in registering "|| name,"","E","buttons.",1,)
  207.  
  208.     ok = VRDestroy(registerwindow_id)
  209.     call listclasses
  210. return
  211.  
  212. /*:VRX         PB_8_Click
  213. */
  214. PB_8_Click:
  215.     exit
  216. return
  217.  
  218. /*:VRX         PB_9_Click
  219. */
  220. PB_9_Click:
  221.     aboutwindow_id = VRLoadSecondary(About)
  222. return
  223.  
  224. /*:VRX         Quit
  225. */
  226. Quit:
  227.     window = VRWindow()
  228.     call VRSet window, "Shutdown", 1
  229.     drop window
  230. return
  231.  
  232. /*:VRX         RegisterWindow_Close
  233. */
  234. RegisterWindow_Close:
  235.     window = VRInfo( "Object" )
  236.     call VRDestroy window
  237.     drop window
  238. return
  239. /*:VRX         Window1_Close
  240. */
  241. Window1_Close:
  242.     call Quit
  243. return
  244.  
  245.