FNC.PRG placed on the public domain by Rob Arnold, 11/14/88 What is FNC.PRG? FNC.PRG is a collection of useful Clipper S'87 UDFs that I've built up over a couple years of programming. While none of these are technological marvels, they are great time savers. I'm placing them on the public domain in the hopes that some of you won't have to reinvent the wheel. Most of the functions are user interface functions for use when you want a user to select a record, field, array element, list element, file. Others let you issue warnings, ask questions or prompt for a disk change. The nice thing about all of these functions is that they do their job and then clean up after themselves, restoring the screen to the way it was when they were called. This way the programmer doesn't have to worry about it. Just call the function and act on the result. Using FNC To use FNC just compile it under Clipper S87 as a single module and include it when linking. Also in the main module of your program include the following lines. . . Many of the functions in FNC expect the variables FRAME_1 and FRAME_2 to be around. Thes are border strings for the BOX command. Alternatively you could add a procedure INIT to FNC that declares these variables as PUBLIC and gives them their values. Just make sure they're there. Bugs These functions have been used in many programs and are fairly stable. However, problems could arise if some of the variable names are duplicated in your program. What I should do is go through and declare each variable as PRIVATE and precede each reference by M-> but I've left that as an excercise for the reader (okay, I admit it, I was lazy). Whats in FNC.PRG The following is a list of the procedures and functions in FNC.PRG FUNCTION choose Select a record from a file in a scrolling box. FUNCTION a_choose Select an element from an array from a scrolling box FUNCTION select_file Select a filename from a scrolling box FUNCTION c_choose Select an item from a list FUNCTION choose_field Select a field from the current database PROCEDURE scr_title Put a title on line 0 PROCEDURE show_file Browse a DOS file < 64K. FUNCTION center Center a string FUNCTION r_justify Right justify a string PROCEDURE exclaim Print a warning, wait for keypress then restore screen. ÚÄ¿ ³!³ You can't do that. (Press any Key) ÀÄÙ FUNCTION confirmed Ask a YN question, get answer then restore screen. ÚÄ¿ ³?³ Are you nuts? (Y/N) ÀÄÙ FUNCTION num_days Number of days in a given month. PROCEDURE disk_wait Print disk icon, ask for disk, wait for keypress then restore screen. ÚÄÄÄ¿ ³ -³ So, like, Put a disk in, eh. . . (Press Any Key) ÀÄÄÄÙ FUNCTION printer_ready Check printer, if ready return .T. if not print printer icon, wait for keypress and check again. Return .F. if user presses Esc. ÚÄÄÄ¿ ³ ! ³ ÕÍÏÍÍÍÏÍÍÍÍÍ͸ þ³ ÜÜÜÜ ³þ The printer is not ready (Press any key, Esc aborts). ÀÄÄÄÄÄÄÄÄÄÄÄÄÙ PROCEDURE a3_reindex Reindex indexes found in Alpha/three DRF file FUNCTION disk_in Call DISK_WAIT then check that disk is in (DOS 3.x) FUNCTION str_replace Replace all occurances of a sub-string FUNCTION time_valid Validate military time (strict). Questions or comments may be directed to: Rob Arnold c/o Tai-Gear Simulations P.O. Box 2231 Indianapolis, IN 46206-2231