*-------------------------------------------------*
*                  PUTGET.ZIP                     *
*                                                 *
*             nputfil() -- ngetfil()              *
*                                                 *             
*       Notes by Adrian Humphreys, 08/19/94       *
*        CIS 73730,1214 -- adrianH@aol.com        *
*       Comments and corrections encouraged.      *
*                                                 *
*-------------------------------------------------*

These are two functions which replace the native
FoxPro functions PUTFILE() and GETFILE().  Both
FoxPro functions fail when the user enters a file 
name that references an invalid drive or selects 
a floppy drive with no disk installed.  Your user
is dumped to DOS with the "abort,retry,fail" message.

FoxProMac doesn't have this problem.  I don't know
what happens in FoxProWin.  So for xlatform users,
both nputfil() and ngetfil() use IF _MAC OR _DOS to 
just call PUTFILE() or GETFILE() and immediately
RETURN.  If you're writing exclusively for mac, 
use the native functions.  Windows users: let me know. 

These functions are just revisions and adaptations
of nputfil(), written by Brian Calahan.   

I've taken the liberty of using his 'nputfil()' name
for this updated version of the PUTFILE() replacement.

Both functions use Pat Adams' chk_drv() C function
to check the drives, so we can inform the user if 
his selected drive is invalid. Y.A. Griver's 
strippat() (part of the CodeBook application development
system by Flash Creative Management, CIS: 71541,3150) 
is incorporated into nputfil() by permission.

I've zipped the following into this package:

nputfil.scx -- The nputfil() screen, FPD2.5. 
nputfil.sct

ngetfil.scx -- The ngetfil() screen, FPD2.5.
ngetfil.sct

putget.txt  -- This description.

chk_drv.plb -- Pat Adams' compiled library. Source and
               and documentation is in lib 12 as
               CHKDRV.ZIP. The following copyright
               notice accompanies the code: 
               CHK_DRV.PLB was written by Ania Glazek 
               and is copyrighted by:

               DB Unlimited
               2111 Albemarle Terrace
               Brooklyn, NY  11226
               (718) 469-4032

               It is placed into public domain with 
               the follwing restrictions:

               CHK_DRV.PLB and the associated C code 
               may not be used in books and articles.
               This right is reserved to DB Unlimited.
               CHK_DRV.PLB may be freely used in YOUR
               applications.  

*-------------------------------------------------*
*          Using nputfil() and ngetfil()          *
*-------------------------------------------------*
Both functions are called the same way you call the
native functions. See the FoxPro manual for details.
A minor difference is that PUTFILE() differentiates 
between the delimiters ";" and "|" on the extensions 
list -- nputfil() doesn't. 

Another difference is that nputfil() provides better 
feedback when the user enters reserved DOS names, 
invalid characters (like + or =), or invalid character 
sequences (like \\ or \.)

When you generate the screen code or add these functions 
to your project:
  1. Save with the extension ".prg", not the default ".spr".
     (This lets you call the screen as a function, e.g.
      myfile= nputfil().)
  2. Check the "modal" box.
  3. Add chk_drv.plb to the project.

*-------------------------------------------------*
*      List of revisions to Brian Calahan's       *
*            original nputfil():                  *
*-------------------------------------------------*
These revisions generally make nputfil() more closely
mimic the behavior of FoxPro's PUTFILE(). 

Enable the l_allfils check box function. Dim and check
  the box when no extension parm is passed.
SET LIBRARY TO chk_drv ADDITIVE.
Mods to mkdirpop allow moving up&down directory
  popup.
Major mod to proc dressarr. Speeds up all displays.
Build proc as a single screen set (rather than prg+spr).
Accept multiple extension list parameter with wild cards.
Check for invalid chars in filename, auto-truncate
  when names > 8 chars or extension > 3 chars.
Auto add extension when default name is chosen.
Trap invalid drive when -typed- into entry field.
Add parameter checking.
Put cursor a top of file list after directory or 
  drive change. 
Display full path name in entry field--update display as
  cursor moves in field list. Carry 8/11-char filename as
  user changes directories.
Activate <save> button when user selects from file list.
Display a PUTFILE()-style alert if entered/chosen filename 
  already exists.
Rename window for consistency with 'CodeBook' conventions.
Trap for _mac/_windows platforms.
*-------------------------------------------------*

 


