home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / FOXPRO / TABLES / TBLSRC / TABLE.DOC next >
Text File  |  1992-11-13  |  5KB  |  126 lines

  1.                       Field Table Routines
  2.                                by
  3.                          Mark D. Miller
  4.                            71054,3103
  5.  
  6. The .zip file you downloaded should contain the following files:
  7.  
  8.      TBLDEMO.EXE         Executable showing the routines in action.
  9.      TBLDEMO.PRG         Demo program source.
  10.      TBLSAMP.DBF         Sample database.
  11.      TBLSAMP.FDX         Sample index.
  12.      TABLE.LIB           The linkable library of routines.
  13.      TABLE.HDR           The function and procedure declarations.
  14.      TABLE.DOC           This file.
  15.                -AND-
  16.      SEX.TBL             Example table files.
  17.      EEOC.TBL
  18.      STATE.TBL
  19.      PROGRAM.TBL
  20.  
  21. If you did not receive all of these files or if any of the files
  22. were corrupted, please leave me a message in the FORCE forum on
  23. CIS.
  24.  
  25.                              PURPOSE
  26.  
  27. The purpose of this library is to provide the developer with a
  28. simple but elegant method of allowing the end user to vary the
  29. input into various multiple choice fields while still maintaining
  30. control over what actually is input.
  31.  
  32. The table routines are self-validating, meaning that they will not
  33. allow an entry into a field that has not been defined in the table.
  34.  
  35.                         WHAT ARE TABLES?
  36.  
  37. The table itself is simple to construct with any ASCII text editor.
  38. The table is simply a list of ASCII strings describing the table
  39. contents, with the first line in the table being reserved as a
  40. HEADER line to determine the TYPE of the table.
  41.  
  42. Tables come in two flavors: RELATIVE and INDEXED.  Both are
  43. described below.
  44.  
  45.      RELATIVE                           INDEXED
  46. 1 Tools                            2 Nationalities
  47. Anvil                              E-English
  48. Screwdriver (Standard)             B-British
  49. Screwdriver (Phillips)             C-Chinese
  50. Wrench (Box End)                   J-Japenese
  51. Wrench (Open End)                  G-German
  52. Wrench (Combination)               H-Hungarian
  53.  
  54. Note the differences between the two tables.  A RELATIVE table
  55. simply assigns each line a number, such that Anvil becomes number
  56. 1 in your field and Wrench (Open End) becomes number 5.  An INDEXED
  57. table, on the other hand uses the KEY (that part of the string
  58. before the hyphen) as the field value and the INDEX into the table.
  59. Note that the KEY can be from 1 to 4 characters long and a table
  60. can have keys of varying lengths as long as the GET field on the
  61. screen is as long as the longest key in the table.
  62.  
  63. Note also that order does not matter in the tables but you may want
  64. to place the most likely used entries near the top of the table.
  65.  
  66.                      USING THE TABLE LIBRARY
  67.  
  68. Using the table routines in your programs is straightforward. 
  69. Simply follow the example given in the TBLDEMO.PRG program.  Listed
  70. below is the parameters for the TABLE() and VERIFYTABLE()
  71. functions.
  72.  
  73. FUNCTION UINT Table
  74.      PARAMETERS CONST    CHAR( 8 ) Name,;
  75.                 CONST    UINT      TableRow,;
  76.                 CONST    UINT      TableCol,;
  77.                 CONST    UINT      Length,;
  78.                          CHAR( 4 ) PKey
  79. FUNCTION LOGICAL VerifyTable
  80.      PARAMETERS CONST    CHAR( 8 ) Name,;
  81.                 CONST    UINT      TableRow,;
  82.                 CONST    UINT      TableCol,;
  83.                 CONST    UINT      Length,;
  84.                          CHAR( 4 ) PKey
  85.  
  86.      CHAR( 8 ) Name
  87.           This is the DOS file name of the table file to use. 
  88.           Table files must be in the same directory as the program
  89.           and must have the extension ".tbl".  The name MUST BE IN
  90.           ALL CAPS.
  91.  
  92.      UINT TableRow
  93.      UINT TableCol
  94.      UINT Length
  95.           These three parameters tell the library where to display
  96.           the table values and how long the longest table value
  97.           will be.  The portion of the line starting at
  98.           TableRow,TableCol and extending for Length characters
  99.           will be cleared whenever the GET field is accessed.
  100.  
  101.      CHAR( 4 ) PKey
  102.           This is the name of the GET field that this table is
  103.           attached to.  This is so the library can read what the
  104.           current value in the GET field is.
  105.  
  106.                       COMPILING AND LINKING
  107.  
  108. Follow the guidelines in TBLDEMO.PRG to attach the table routines
  109. to your GET fields, compile your programs as you would normally and
  110. link with the table library as follows:
  111.  
  112.                LINK TBLDEMO,,,FORCE+TABLE;
  113. Note this example is for MSLINK and assumes all modules are in the
  114. current directory or on your search path.
  115.  
  116.  
  117.                            CONCLUSION
  118.  
  119. Comments and suggestions are welcome.  If you find these routines
  120. useful, I would appreciate your support by sending a $5.00 check
  121. to:
  122.           Mark D. Miller
  123.           612 Fairview Blvd. Apt. RNW
  124.           Rockford, IL   61107
  125.  
  126.