home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 13 / AACD13.ISO / AACD / Utilities / QuickFile / ARexx / SetCycle.quickfile < prev    next >
Text File  |  2000-05-28  |  2KB  |  75 lines

  1. /*
  2. $VER: SetCycle.quickfile 1.0 (29 May 2000  01:48:24) By M Andre Z Eckenrode
  3.  
  4. Opens a listview requester (via 'RxListReq' by Robert Dickow) displaying all
  5. available values for a cycle field, with which a new value for the field may be
  6. selected, if the number of available values for the field exceeds the variable
  7. <maxvalues> below (change as desired); or, sets the field to its next, or
  8. first, value, if the number of values is less than or equal to <maxvalues>.
  9. Ideal for use with function keys.
  10.  
  11. Requires QuickFile v3.24 or higher, the name of the cycle field as an argument,
  12. and 'rexxsupport.library' and 'RxListReq' (available from Aminet in util/rexx),
  13. which must reside in the command path, if the requester is to be opened.
  14. */
  15.  
  16. options results
  17.  
  18. fld = upper(arg(1))
  19. query field 'FLD "'fld'"'
  20. if rc = 5 then do
  21.     reqmsg '"Field \039'fld'\039 not found."'
  22.     exit
  23. end
  24. else if upper(fld.type) ~= 'CYCLE' then do
  25.     reqmsg '"\039'fld'\039 not a cycle field."'
  26.     exit
  27. end
  28.  
  29. query cycle 'FLD "'fld'"'
  30.  
  31. maxvalues = 5
  32.  
  33. /*
  34. Change the value 'maxvalues' above as desired to automatically cycle forward
  35. for cycle fields with fewer or more available values.
  36. */
  37.  
  38. if fld.0 <= maxvalues then do
  39.     getfield '"'fld'"'
  40.     val = result
  41.     query cycle 'FLD "'fld'"'
  42.     do i = 1 to fld.0 while fld.i ~== val
  43.         nop
  44.     end
  45.     if i < fld.0 then i = i+1
  46.     else i = 1
  47.     val.sel = fld.i
  48. end
  49. else do
  50.     port = 'RXLISTREQ'
  51.     if ~show('p',port) then do
  52.         address command 'run rxlistreq'
  53.         lib = 'rexxsupport.library'
  54.         if ~show('l',lib) then call addlib(lib,0,-30)
  55.         do 50 while ~show('p',port)
  56.             call delay(5)
  57.         end
  58.     end
  59.     
  60.     do i = 1 to fld.0
  61.         ii = i-1
  62.         val.ii = fld.i
  63.     end
  64.  
  65.     rxlv.lvlabel = 'Select new value for '''fld'''.'
  66.     rxlv.width = 250 /* Adjust this value to accomodate your screen font */
  67.     rxlv.height = 200
  68.     address 'RXLISTREQ' rxlistreq fld.0 val
  69.     if rxlv.exit ~== 'LIST' then exit
  70.     sel = rxlv.clicked
  71. end
  72.  
  73. putfield '"'fld'" "'val.sel'"'
  74. updrec
  75.