home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vxdemo.zip / OBJLIST.$$$ / OBJLIST.VRX < prev    next >
Text File  |  1993-09-03  |  4KB  |  185 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. /*  Load the windows
  27. */
  28.     call VRInit
  29.     parse source . . spec
  30.     _VREPrimaryWindowPath = ,
  31.         VRParseFileName( spec, "dpn" ) || ".VRW"
  32.     _VREPrimaryWindow = ,
  33.         VRLoad( parent, _VREPrimaryWindowPath )
  34.     drop parent spec
  35.     if( _VREPrimaryWindow == "" )then do
  36.         call VRMessage "", "Cannot load window:" VRError(), ,
  37.             "Error!"
  38.         _VREReturnValue = 32000
  39.         signal _VRELeaveMain
  40.     end
  41.  
  42. /*  Process events
  43. */
  44.     call Init
  45.     signal on halt
  46.     do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
  47.         _VREEvent = VREvent()
  48.         interpret _VREEvent
  49.     end
  50. _VREHalt:
  51.     _VREReturnValue = Fini()
  52.     call VRDestroy _VREPrimaryWindow
  53. _VRELeaveMain:
  54.     call VRFini
  55. exit _VREReturnValue
  56.  
  57. VRLoadSecondary: procedure
  58.     name = arg( 1 )
  59.  
  60.     window = VRLoad( VRWindow(), VRWindowPath(), name )
  61.     call VRMethod window, "CenterWindow"
  62.     call VRSet window, "Visible", 1
  63.     call VRMethod window, "Activate"
  64. return window
  65.  
  66. /*:VRX         DisplayNotebooks
  67. */
  68. DisplayNotebooks: procedure expose InitArgs.
  69.  
  70. /*
  71. call vrredirectstdio
  72. trace r
  73. */
  74.     ok = VRMethod( "ObjectList", "GetSelectedStringList", "selectedList." )
  75.     do i = 1 to selectedList.0
  76.         parse VAR selectedList.i . ';' hnd                
  77.         call VRMethod InitArgs.2, "NotebookOpen", hnd
  78.     end
  79.     call Quit
  80.  
  81. return
  82.  
  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.  
  100. Init: procedure expose nameList. hndList. InitArgs.  
  101.  
  102. /*  Assume invoked as a VRXEDIT macro so
  103.         InitArgs.0 = 2
  104.         InitArgs.1 = <object>
  105.         InitArgs.2 = <editWindow>
  106. */
  107.     window = VRWindow()
  108.     call VRMethod window, "CenterWindow"
  109.  
  110. /*  Fill list with names of objects in hndList.
  111. */ 
  112.     call VRMethod InitArgs.2, "ListChildren", "hndList." 
  113.     nameList.0 = hndList.0
  114.     do i = 1 to hndList.0
  115.         nameList.i = Left( VRGet(hndList.i, "Name"), 30 ) || ';' || hndList.i
  116.     end
  117.  
  118. /* Display the List of Objects
  119. */
  120.     ok = VRMethod( "ObjectList", "AddStringList", "nameList.", )
  121.     ok = VRSet( "ObjectList", "Selected", 1 )
  122.  
  123.     objname = VRGet( InitArgs.2, "Name" )
  124.     call VRSet window, "Caption", "Object list for" objname
  125.  
  126.     call VRSet window, "Visible", 1
  127.     call VRMethod window, "Activate"
  128.  
  129.     return
  130.  
  131.  
  132. /*:VRX         ObjectList_DoubleClick
  133. */
  134. ObjectList_DoubleClick:
  135.     call DisplayNotebooks
  136. return
  137.  
  138. /*:VRX         OpenNotebook_Click
  139. */
  140. OpenNotebook_Click:
  141.     call DisplayNotebooks
  142. return
  143.  
  144. /*:VRX         Quit
  145. */
  146. Quit:
  147.     window = VRWindow()
  148.     call VRSet window, "Shutdown", 1
  149.     drop window
  150. return
  151.  
  152. /*:VRX         Window1_Close
  153. */
  154. Window1_Close:
  155.     call Quit
  156. return
  157.  
  158. /*:VRX         Window1_Resize
  159. */
  160. Window1_Resize:
  161. /*
  162.     ok = VRSet( "Window1", "Painting", 0 )
  163.  
  164.     top = VRGet( "ObjectList", "Top" )
  165.     left = VRGet( "ObjectList", "Left" )
  166.  
  167.  
  168.     height = VRGet( "Window1", "InteriorHeight" ) ,
  169.         - VRGet( "OpenNotebook", "Height" )
  170.     width = VRGet( "Window1", "InteriorWidth" )
  171.  
  172.     ok = VRSet( "OpenNotebook", ,
  173.         "Top", height - top, ,
  174.     )
  175.  
  176.     ok = VRSet( "ObjectList", ,
  177.         "Height", height - 3 * top, ,
  178.         "Width", width - 3 * left, ,
  179.     )
  180.  
  181.     ok = VRSet( "Window1", "Painting", 1 )
  182. */
  183. return
  184.  
  185.