home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a013 / 1.ddi / SOURCE.EXE / F_NDXVEW.PRG < prev    next >
Encoding:
Text File  |  1991-01-25  |  1.6 KB  |  62 lines

  1. *****************************************************************
  2. FUNCTION NDXVIEW (extension, ndx_path)
  3. *****************************************************************
  4.  
  5. * Display index key expressions during application development
  6.  
  7. * Copyright(c) 1991 -- James Occhiogrosso
  8.  
  9. # include "box.ch"
  10.  
  11. LOCAL files := {}, list := {}
  12.  
  13. * Save the entry screen
  14. LOCAL old_screen := SCRNSAVE(1, 1, MAXROW()-1, MAXCOL()-1)
  15.  
  16. * Get type of indexes for running application
  17. LOCAL clip_ntx := IF(INDEXEXT() = '.NDX', .F., .T.)
  18.  
  19. * If path or extension is not passed,  use defaults
  20.  
  21. IF VALTYPE(extension) != 'C'
  22.     * Default extension is "NTX"
  23.     extension = "NTX"
  24. ENDIF
  25.  
  26. IF ndx_path = NIL
  27.     * Default path is no path (current directory)
  28.     ndx_path = ''
  29. ELSEIF VALTYPE(ndx_path) = 'C'
  30.     ndx_path = TRIM(ndx_path)
  31.     IF RIGHT(ndx_path, 1) != '\'
  32.         ndx_path = ndx_path + '\'
  33.     ENDIF
  34. ELSE
  35.     RETURN NIL
  36. ENDIF
  37.  
  38. * Get the number of files and load filenames to an array
  39. files = DIRECTORY(ndx_path + '*.' + extension)
  40.  
  41. * If any files are found
  42. IF files != NIL
  43.     * Load list array with file name and key expression
  44.     FOR counter = 1 TO LEN(files)
  45.          AADD(list, PADR(files[counter][1], 17) +  ;
  46.               NDXKEY(ndx_path + files[counter][1], clip_ntx))
  47.     NEXT
  48.  
  49.     * Display a boxed heading
  50.     @ 1, 1, MAXROW()-1, MAXCOL()-1 BOX B_SINGLE + ' '
  51.     @ 2, 4  SAY ' Index Name '
  52.     @ 2, 31 SAY ' Key Expression '
  53.     @ 3, 4  SAY REPLICATE('─', MAXCOL() - 7)
  54.  
  55.     * Display the array with ACHOICE
  56.     ACHOICE(4, 4, MAXROW()-2, MAXCOL()-4, list)
  57. ENDIF
  58.  
  59. * Restore the screen and return
  60. SCRNREST(old_screen)
  61. RETURN NIL
  62.