home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vxcliser.zip / VXREXX.2 / MACROS / OBJLIST.VRM < prev    next >
Text File  |  1994-12-23  |  4KB  |  161 lines

  1. /* Custom mainline for macro */
  2.  
  3.     call RXFuncAdd "VRLoadFuncs", "VROBJ", "VRLoadFuncs"
  4.     call VRLoadFuncs
  5.  
  6.     _VREVersion = SubWord( VRVersion( "VRObj" ), 1, 1 )
  7.     if( _VREVersion < 2.01 )then do
  8.         call VRMessage "", "This program requires VX-REXX version 2.0a to run.", "Error!"
  9.         return 32000
  10.     end
  11.  
  12.     signal on SYNTAX name _VRESyntax
  13.     signal _VREMain
  14.  
  15. _VRESyntax:
  16.     parse source . . _VRESourceSpec
  17.     call VRMessage "", "Syntax error in" _VRESourceSpec "line" SIGL, "Error!"
  18.     exit 32000
  19.  
  20. _VREMain:
  21. /*:VRX         Main
  22. */
  23. /*  Main
  24. */
  25. Main:
  26. /*  Process the arguments.
  27.     Get the parent window.
  28. */
  29.     parse source . calledAs .
  30.     parent = ""
  31.     argCount = arg()
  32.     argOff = 0
  33.     if( calledAs \= "COMMAND" )then do
  34.         if argCount >= 1 then do
  35.             parent = arg(1)
  36.             argCount = argCount - 1
  37.             argOff = 1
  38.         end
  39.     end
  40.     InitArgs.0 = argCount
  41.     if( argCount > 0 )then do i = 1 to argCount
  42.         InitArgs.i = arg( i + argOff )
  43.     end
  44.     drop calledAs argCount argOff
  45.  
  46. /*  Load the windows
  47. */
  48.     call VRInit
  49.     parse source . . spec
  50.     _VREPrimaryWindowPath = ,
  51.         VRParseFileName( spec, "dpn" ) || ".VRW"
  52.     _VREPrimaryWindow = ,
  53.         VRLoad( parent, _VREPrimaryWindowPath )
  54.     drop parent spec
  55.     if( _VREPrimaryWindow == "" )then do
  56.         call VRMessage "", "Cannot load window:" VRError(), ,
  57.             "Error!"
  58.         _VREReturnValue = 32000
  59.         signal _VRELeaveMain
  60.     end
  61.  
  62. /*  Process events
  63. */
  64.     call Init
  65.     signal on halt
  66.     do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
  67.         _VREEvent = VREvent()
  68.         interpret _VREEvent
  69.     end
  70. _VREHalt:
  71.     _VREReturnValue = Fini()
  72.     call VRDestroy _VREPrimaryWindow
  73. _VRELeaveMain:
  74.     call VRFini
  75. exit _VREReturnValue
  76.  
  77. VRLoadSecondary: procedure
  78.     name = arg( 1 )
  79.  
  80.     window = VRLoad( VRWindow(), VRWindowPath(), name )
  81.     call VRMethod window, "CenterWindow"
  82.     call VRSet window, "Visible", 1
  83.     call VRMethod window, "Activate"
  84. return window
  85.  
  86. /*:VRX         DisplayNotebooks
  87. */
  88. DisplayNotebooks: procedure expose InitArgs.
  89.     call VRMethod "LB_Objects", "GetSelectedList", "stem."
  90.     do i = 1 to stem.0
  91.         object = VRMethod( "LB_Objects", "GetItemData", stem.i )
  92.         call VRMethod InitArgs.2, "NotebookOpen", object
  93.     end
  94.     call Quit
  95. return
  96.  
  97. /*:VRX         Fini
  98. */
  99. Fini:
  100.     window = VRWindow()
  101.     call VRSet window, "Visible", 0
  102.     drop window
  103. return 0
  104.  
  105. /*:VRX         Halt
  106. */
  107. Halt:
  108.     signal _VREHalt
  109. return
  110.  
  111. /*:VRX         Init
  112. */
  113. /*  Assume invoked as a VRXEDIT macro so
  114.         InitArgs.0 = 2
  115.         InitArgs.1 = <object>
  116.         InitArgs.2 = <editWindow>
  117. */
  118. Init: procedure expose InitArgs.  
  119.     window = VRWindow()
  120.     call VRMethod window, "CenterWindow"
  121.  
  122.     call VRMethod InitArgs.2, "ListChildren", "objects."
  123.     do i = 1 to objects.0
  124.         position = VRMethod( "LB_Objects", "AddString", VRGet(objects.i, "Name") )
  125.         call VRMethod "LB_Objects", "SetItemData", position, objects.i  
  126.     end
  127.  
  128.     call VRSet "LB_Objects", "Selected", 1
  129.     call VRSet window, "Caption", "Object list for" VRGet( InitArgs.2, "Name" )
  130.     call VRSet window, "Visible", 1
  131.     call VRMethod window, "Activate"
  132. return
  133.  
  134.  
  135. /*:VRX         LB_Objects_DoubleClick
  136. */
  137. LB_Objects_DoubleClick:
  138.     call DisplayNotebooks
  139. return
  140.  
  141. /*:VRX         PB_Open_Click
  142. */
  143. PB_Open_Click:
  144.     call DisplayNotebooks
  145. return
  146.  
  147. /*:VRX         Quit
  148. */
  149. Quit:
  150.     window = VRWindow()
  151.     call VRSet window, "Shutdown", 1
  152.     drop window
  153. return
  154.  
  155. /*:VRX         Window1_Close
  156. */
  157. Window1_Close:
  158.     call Quit
  159. return
  160.  
  161.