home *** CD-ROM | disk | FTP | other *** search
- *****************************************************************
- FUNCTION NDXVIEW (extension, ndx_path)
- *****************************************************************
-
- * Display index key expressions during application development
-
- * Copyright(c) 1991 -- James Occhiogrosso
-
- # include "box.ch"
-
- LOCAL files := {}, list := {}
-
- * Save the entry screen
- LOCAL old_screen := SCRNSAVE(1, 1, MAXROW()-1, MAXCOL()-1)
-
- * Get type of indexes for running application
- LOCAL clip_ntx := IF(INDEXEXT() = '.NDX', .F., .T.)
-
- * If path or extension is not passed, use defaults
-
- IF VALTYPE(extension) != 'C'
- * Default extension is "NTX"
- extension = "NTX"
- ENDIF
-
- IF ndx_path = NIL
- * Default path is no path (current directory)
- ndx_path = ''
- ELSEIF VALTYPE(ndx_path) = 'C'
- ndx_path = TRIM(ndx_path)
- IF RIGHT(ndx_path, 1) != '\'
- ndx_path = ndx_path + '\'
- ENDIF
- ELSE
- RETURN NIL
- ENDIF
-
- * Get the number of files and load filenames to an array
- files = DIRECTORY(ndx_path + '*.' + extension)
-
- * If any files are found
- IF files != NIL
- * Load list array with file name and key expression
- FOR counter = 1 TO LEN(files)
- AADD(list, PADR(files[counter][1], 17) + ;
- NDXKEY(ndx_path + files[counter][1], clip_ntx))
- NEXT
-
- * Display a boxed heading
- @ 1, 1, MAXROW()-1, MAXCOL()-1 BOX B_SINGLE + ' '
- @ 2, 4 SAY ' Index Name '
- @ 2, 31 SAY ' Key Expression '
- @ 3, 4 SAY REPLICATE('─', MAXCOL() - 7)
-
- * Display the array with ACHOICE
- ACHOICE(4, 4, MAXROW()-2, MAXCOL()-4, list)
- ENDIF
-
- * Restore the screen and return
- SCRNREST(old_screen)
- RETURN NIL
-