home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / checkt.zip / WINDOW1.VRX < prev    next >
Text File  |  1995-01-23  |  5KB  |  225 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         Fini
  67. */
  68. Fini:
  69.     window = VRWindow()
  70.     call VRSet window, "Visible", 0
  71.     drop window
  72. return 0
  73.  
  74. /*:VRX         Halt
  75. */
  76. Halt:
  77.     signal _VREHalt
  78. return
  79.  
  80. /*:VRX         Init
  81. */
  82. Init:
  83.     window = VRWindow()
  84.     call VRMethod window, "CenterWindow"
  85.     call VRSet window, "Visible", 1
  86.     call VRMethod window, "Activate"
  87.     drop window
  88. return
  89.  
  90. /*:VRX         PB_1_Click
  91. */
  92. PB_1_Click:
  93. ok = VRSet( "PB_1", "Enabled", 0 )
  94. ok = VRSet( "CB_1", "Enabled", 0 )
  95. ok = VRSet( "SL_5", "Percentile", 0 )
  96. ok = VRMethod( "LB_1", "Clear" )
  97. source = VRGet( "EF_1", "Value" )
  98. cs = VRGet( "CB_1", "Set" )
  99.  
  100. sftopts='BO'
  101. set = VRGet( "CB_2", "Set" )
  102. if set=1 then sftopts='BOS'
  103. call SysFileTree source, 'path', sftopts
  104. if path.0 = 0 then do
  105.    id = VRMessage( VRWindow(), "No files found", "Error", "None", , ,  )
  106.    ok = VRSet( "PB_1", "Enabled", 1 )
  107.    ok = VRSet( "CB_1", "Enabled", 1 )
  108.    return
  109. end
  110. cur=1
  111. cnt=0
  112. lim=path.0/100
  113. per=0
  114. do i=1 to path.0
  115.    /* Extract the filename from the full path */
  116.    cnt=cnt+1
  117.    if cnt>=lim then do
  118.      cnt=lim-Trunc(lim, "0")     
  119.      per=per+1
  120.      ok = VRSet( "SL_5", "Percentile", per )
  121.    end
  122.    pos =lastpos("\",path.i) + 1
  123.    file.i = substr(path.i,pos)
  124.    /* Get the longname */
  125.    rc = SysGetEA(path.i, ".LONGNAME", "eainfo")
  126.    if rc = 0 then do
  127.       pos = lastpos("00"x,eainfo) + 1
  128.       longname = substr(eainfo,pos)
  129.    end
  130.    else longname = ""
  131.    if longname ¬= "" & streq(file.i, longname,cs) then do
  132.          str=path.i "->" longname 
  133.          position = VRMethod( "LB_1", "AddString", str,  )
  134.          ok = VRMethod( "LB_1", "SetItemData", cur, i )
  135.          cur=cur+1
  136.    end
  137. end
  138. ok = VRSet( "PB_1", "Enabled", 1)
  139. ok = VRSet( "CB_1", "Enabled", 1)
  140. ok = VRSet( "SL_5", "Percentile", 0 )
  141. return
  142.  
  143. streq:
  144. parse arg s1,s2,csen
  145. if csen=0 then do
  146.  s1=Translate( s1 )
  147.  s2=Translate( s2 )
  148. end
  149. if s1¬=s2 then return 1 
  150. return 0
  151. /*:VRX         PB_2_Click
  152. */
  153. PB_2_Click:
  154. ok = VRMethod( "LB_1", "GetSelectedList", "sel." )
  155. if sel.0>0 then do
  156.  do s=1 to sel.0
  157.    i= VRMethod( "LB_1", "GetItemData", sel.s)
  158.    /* Extract the filename from the full path */
  159.    pos =lastpos("\",path.i) + 1
  160.    file.i = substr(path.i,pos)
  161.    /* Get the longname */
  162.    rc = SysGetEA(path.i, ".LONGNAME", "eainfo")
  163.    if rc = 0 then do
  164.       pos = lastpos("00"x,eainfo) + 1
  165.       longname = substr(eainfo,pos)
  166.    end
  167.    else longname = ""
  168.    eainfo = "DFFF00000100FDFF"x || d2c(length(file.i))||"00"x||file.i
  169.    rc = SysPutEA(path.i, ".LONGNAME", eainfo)
  170.   end
  171.   ok=VRMethod( "LB_1", "DeleteList", "sel." )
  172. end
  173. return
  174. /*:VRX         PB_3_Click
  175. */
  176. PB_3_Click:
  177.  
  178. count = VRGet( "LB_1", "Count" )
  179. sel.0=count
  180. do i=1 to count
  181.   sel.i=i
  182. end
  183. ok = VRMethod( "LB_1", "SetSelectedList", "sel." )
  184. return
  185.  
  186.  
  187. /*:VRX         PB_4_Click
  188. */
  189. PB_4_Click:
  190.  
  191. count = VRGet( "LB_1", "Count" )
  192. sel.0=count
  193. do i=1 to count
  194.   sel.i=i
  195. end
  196. ok = VRMethod( "LB_1", "DeselectList", "sel." )
  197. return
  198.  
  199.  
  200.  
  201. /*:VRX         Quit
  202. */
  203. Quit:
  204.     window = VRWindow()
  205.     call VRSet window, "Shutdown", 1
  206.     drop window
  207. return
  208.  
  209. /*:VRX         Window1_Close
  210. */
  211. Window1_Close:
  212.     call Quit
  213. return
  214.  
  215. /*:VRX         Window1_Create
  216. */
  217. Window1_Create:
  218. call RxFuncAdd SysLoadFuncs,RexxUtil,SysLoadFuncs
  219. call SysLoadFuncs
  220.  
  221. ok = VRSet( "EF_1", "Value", "C:\*.*" )
  222.  
  223. return
  224.  
  225.