home *** CD-ROM | disk | FTP | other *** search
- ***************************************************************************
- * This PROCEDURE takes advantage of CLIPPER's memofield functions *
- * and uses them as a text editor. These functions can be used on *
- * any character variable as well as memofields. *
- * The functions and their syntax are listed below. *
- * *
- * 1) MEMOEDIT(memo, t, l, b, r, update,ufunc,line_length,tabsize,; *
- * initial_line,initial_col,relative_row,relative_col) *
- * *
- * where: *
- * memo = memo to edit *
- * t, l, b, r = window definition *
- * update = update allowed (default TRUE) *
- * ufunc = <expC> name of user function to handle exceptions*
- * line_length = virtual width and allows horizontal scrolling*
- * tabsize = spaces between regular tab stops (default = 4) *
- * initial_line = initial line where the cursor is placed *
- * initial_col = initial column where the cursor is placed *
- * relative_row = initial row of the cursor relative to window*
- * relative_col = initial col of the cursor relative to window*
- * *
- * 2) MEMOREAD(file) *
- * *
- * where: *
- * file = the name of the file to read from disk *
- * *
- * 3) MEMOWRIT(file, variable) *
- * *
- * where: *
- * file = the name of the file to write to disk *
- * variable = a character variable to store the file contents*
- ***************************************************************************
-
-
- PROCEDURE EDITOR
-
- file_pattern = "*.txt" && The files to edit.
- @ 0, 0 CLEAR
- aray_siz = ADIR(file_pattern) && The amount of files.
- DECLARE aray_dir[aray_siz] && Create array.
- ADIR(file_pattern,aray_dir) && Fill array.
- DO WHILE .T.
- BOXIT(0,0,24,79,2)
- @ 2, 2 TO 4 + aray_siz,17 DOUBLE && Draw box.
- @ 3, 3 CLEAR TO 3 + aray_siz,16 && Clear box.
- mess = "Select a file to EDIT, or <Esc> to exit"
- mess2 = "(hint -> choose <EDIT.TXT> to VIEW the source code)"
- @ 1, 4 get mess
- @ 5,20 get mess2
- clear gets
- FOR file_name = 1 to aray_siz
- @ 3 + file_name,4 PROMPT aray_dir[file_name]
- NEXT && Place file names
- MENU TO which_one && on screen in menu.
- IF which_one = 0 && If escape key was entered
- RETURN && leave the progam.
- ENDIF
- @ 0,0 CLEAR
- SET FUNCTION 3 to chr(23)
- mess = "<F3> to save and exit, <Esc> to exit"
- @ 1,10 get mess
- CLEAR GETS
- @ 2,0 to 24,79 double
- IF aray_dir[which_one] = "EDIT.TXT" && if EDIT.TXT
- MEMOWRIT(aray_dir[which_one],MEMOEDIT(MEMOREAD ; && browes it
- (aray_dir[which_one]),3,1,23,78,.F.)) && othewise
- ELSE && edit it.
- MEMOWRIT(aray_dir[which_one],MEMOEDIT(MEMOREAD ;
- (aray_dir[which_one]),3,1,23,78))
- ENDIF
- SET FUNCTION 3 TO
- @ 0, 0 CLEAR
- ENDDO
-
- *END PROCEDURE
-
-