home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / DMX23.ZIP / READ.ME < prev    next >
Encoding:
Text File  |  1990-02-14  |  16.7 KB  |  490 lines

  1.  
  2.                            DMX  Data Entry Matrix 2.2
  3.                             (C) 1990  Randolph Beck
  4.  
  5.  
  6.     DMX is a Turbo Pascal unit designed to manipulate data entry screens
  7.     in a "browse" format.  This is extremely flexible and powerful.
  8.     You can further enhance its usefulness through creative use of object-
  9.     oriented programming.
  10.  
  11.     We have used this system for more than just data entry.  DMX can also
  12.     be used to create text listers, tables, smart help screens, and more.
  13.  
  14.     DMX requires Turbo Pascal 5.5 or above.
  15.  
  16.     ───────────────────────────────────────────────────────────────────────
  17.  
  18.     This is a shareware product and may be distributed and copied for free,
  19.     providing that no profit is made through such distribution.
  20.  
  21.     Users can register their copy by sending $12.
  22.  
  23.     Registered users will receive a diskette with:
  24.         An updated version of the DMX TPU files;
  25.         Associated program units;
  26.         Full documentation of its internal functions.
  27.  
  28.         The registered version includes full access to the many internal
  29.         procedures and functions which make this system work.
  30.  
  31.  
  32.     The $12 registered version should suffice for most programmers, but
  33.     registered programmers can also order fully documented source code of
  34.     the DMX2.TPU file for an additional $25.  (This can be ordered later.)
  35.  
  36.  
  37.     Business and government organizations are required to register in
  38.     order to continue to use this system.
  39.  
  40.  
  41.         Randolph Beck
  42.         DMX Registration
  43.         P.O. Box 56-0487
  44.         Orlando, FL
  45.         32856-0487
  46.  
  47.         Please include any questions or comments.
  48.  
  49.  
  50.     ───────────────────────────────────────────────────────────────────────
  51.  
  52.     Files included:
  53.  
  54.           READ.ME            This.
  55.  
  56.           DMX2.TPU           Main DMX unit (2.2)
  57.           TVIDEO.OBJ         Required for compiling with DMX2.TPU
  58.           DMX_FILE.PAS       Source code for the file-handling unit
  59.           DMXDFILE.PAS       Source code for the dBASE file-handling unit
  60.  
  61.           DMXAMPLE.PAS       Source code for the simple example
  62.           DBENTRY.PAS        Source code for the dBASE file demo
  63.           DMXAMORT.PAS       Source code for the amortization table demo
  64.  
  65.  
  66.     ───────────────────────────────────────────────────────────────────────
  67.  
  68.                           What Makes DMX So Easy to Use?
  69.  
  70.  
  71.     After deciding upon your record structures, you can pass this to the
  72.     DMX initialization procedure using a formatting string.  This string
  73.     will also determine the display format.
  74.  
  75.     Example:
  76.       A RECORD with a STRING [20], an INTEGER, and a REAL may use this format:
  77.         ' ____________________ | IIII | ($RRR,RRR.RR) '
  78.  
  79.  
  80.     Fields must be delimited by vertical bars ("|").  These will be converted
  81.     into solid lines when displayed.
  82.  
  83.     The data type of each field is determined by the letters in the string.
  84.     There are provisions for most data types, and many different formats.
  85.  
  86.     Programmers only need to alter this one formatting string when changing
  87.     their data structure.
  88.  
  89.  
  90.     ───────────────────────────────────────────────────────────────────────
  91.  
  92.                                 Getting Started
  93.  
  94.  
  95.     The object is initialized with a formatting string, and another string
  96.     which is used for an optional title.
  97.     Also required are five word-types:
  98.        1.  the number of lines above the data entry area;
  99.        2.  the number of lines below the data entry area;
  100.        3.  border color (used only for field separators);
  101.        4.  text color;
  102.        5.  and the color attributes of the hilighted field.
  103.  
  104.     Example:
  105.       DMXwindow.Init (' Name                    ref      balance    ',
  106.                       ' ____________________ | IIII | ($RRR,RRR.RR) ',
  107.                       2,0, Cyan,LightCyan,$3F);
  108.  
  109.  
  110.     (Color $3F indicates white foreground and cyan background.)
  111.  
  112.     ───────────────────────────────────────────────────────────────────────
  113.  
  114.                              Opening the Data Screen
  115.  
  116.  
  117.     DMX is window-sensitive.  Your own program can do the WINDOW procedure
  118.     to change the window position.  (A separate border procedure is included
  119.     in this package for creating borders.)
  120.  
  121.     Use the OpenBuffer procedure to set up the screen.  This requires two
  122.     parameters:  The actual data buffer and the buffer size (in bytes).
  123.  
  124.     The structure of the data in the buffer must be the same as that which
  125.     was specified by the formatting string in the INIT procedure.
  126.     (There are advanced techniques which provide exceptions to most of the
  127.     rules; refer to the AdjustRecSize procedure in the DMXdFILE.PAS example.)
  128.  
  129.     Example:
  130.       DMXwindow.OpenBuffer (DataArray, sizeof (DataArray));
  131.  
  132.  
  133.     ───────────────────────────────────────────────────────────────────────
  134.  
  135.                                 Editing the Data
  136.  
  137.  
  138.     The EditData procedure will take care of your data editing chores.
  139.     The parameters required are the data buffer (same as in the OpenBuffer
  140.     procedure) and keyboard control information:
  141.        Key and Ext are two char types for returning the last key pressed.
  142.        (If the last key was an extended character, the Key will be #0 and
  143.        the extended code will be returned in Ext.)
  144.        KeySet and ExtSet represents the set of characters that will force
  145.        DMX to exit.
  146.  
  147.     Example:
  148.       DMXwindow.EditData (DataArray, Key,ext, [^C,Esc],[F1,F10]);
  149.  
  150.  
  151.    (Note that 'Esc','F1', & 'F10' are assumed to be the character constants
  152.     that correspond to the character codes for those particular keys.)
  153.  
  154.  
  155.     ───────────────────────────────────────────────────────────────────────
  156.  
  157.                                   Quick Recap
  158.  
  159.  
  160.     To initialize the object;  draw the screen;  and edit the data:
  161.  
  162.  
  163.         DMXwindow.Init (' Name                    ref      balance    ',
  164.                         ' ____________________ | IIII | ($RRR,RRR.RR) ',
  165.                         2,0, Cyan,LightCyan,$3F);
  166.  
  167.  
  168.         DMXwindow.OpenBuffer (DataArray, sizeof (DataArray));
  169.  
  170.  
  171.         DMXwindow.EditData (DataArray, Key,ext, [^C,Esc],[F1,F10]);
  172.  
  173.  
  174.  
  175.  
  176.     ───────────────────────────────────────────────────────────────────────
  177.  
  178.                                 A Simple Example
  179.  
  180.  
  181.     This is a very simple example.  It does not provide a fancy border,
  182.     nor does it include a facility to save the data.  It is meant only
  183.     to show how easily a data entry screen can be created.
  184.  
  185.  
  186.     Program DEMO;
  187.     uses Dos,Crt,DMX2;
  188.     type DataRec    = record
  189.                         S :string [20];  I :integer;  R :real;
  190.                       end;
  191.     var  Key,ext    : char;
  192.          DataArray  : array [0..99] of DataRec;
  193.          DMXa       : Dwindow;
  194.     Begin
  195.       ClrScr;
  196.       Window (18,2,69,22);
  197.  
  198.       FillChar (DataArray, sizeof (DataArray), 0);  { clear the database }
  199.  
  200.       DMXa.Init (' Name                    ref      balance    ',
  201.                  ' ____________________ | IIII | ($RRR,RRR.RR) ',
  202.                   2,1, Cyan,LightCyan,$3F);
  203.  
  204.       DMXa.OpenBuffer (DataArray, sizeof (DataArray));
  205.  
  206.       DMXa.EditData (DataArray, Key,ext, [Esc],[F1,F10]);
  207.  
  208.       ClrScr;
  209.     End.
  210.  
  211.  
  212.     ───────────────────────────────────────────────────────────────────────
  213.  
  214.                             File-Handling Procedures
  215.  
  216.  
  217.     Loading and saving data is not directly a function of DMX.
  218.     DMX_FILE.PAS contains Dwindow --which is a descendant object
  219.     of DMXwindow for simple file-handling chores.
  220.  
  221.     Dwindow has two procedures:
  222.  
  223.       Dwindow.LoadDataBlock (DataArray, sizeof (DataArray), F);
  224.  
  225.       Dwindow.SaveDataBlock (DataArray, F);
  226.  
  227.  
  228.     The file variable F must have been previously ASSIGNed.
  229.  
  230.     See DMXdFILE.PAS for examples of these procedures.
  231.  
  232.  
  233.     ───────────────────────────────────────────────────────────────────────
  234.  
  235.                         How Can I Make DMX More Powerful?
  236.                               Advanced Programming
  237.  
  238.  
  239.     Object-oriented programming is what makes DMX powerful.  But we have
  240.     only scratched the surface.
  241.  
  242.     DMX allows Pascal programmers to quickly create a data entry screen.
  243.     Object-oriented programming allows programmers to change DMX itself.
  244.  
  245.  
  246.     For instance:  DMX, by itself, only concerns itself with data entry.
  247.     It does not display the current record number in any particular place.
  248.     However, there are several virtual procedures in this object which have
  249.     been reserved for specialized use.
  250.  
  251.     Programmers can create a descendant object with a procedure called:
  252.     SetUpRecord.  This procedure is used internally before editing each
  253.     record -- and originally did nothing.  A descendant for SetUpRecord
  254.     can display the current record number whereever the programmer decides.
  255.  
  256.  
  257.     Another example:  The primary DMX unit requires that the entire database
  258.     should be loaded into an array.
  259.     But this can be circumvented by the DataAt virtual method.
  260.  
  261.     Each time that DMX accesses a record, the location is provided by the
  262.     DataAt function.  This function is given a record number to calculate a
  263.     memory address in the data array.
  264.  
  265.     A descendant for the DataAt function can be written to read the
  266.     record from a file, and return a pointer to where it is is stored.
  267.     The example program DBENTRY.PAS works this way.
  268.  
  269.  
  270.     Descendant objects can also be written to remove a feature from DMX.
  271.     The procedure ZeroizeRecord (var RecordData ) is called whenever the
  272.     user presses ^Y.
  273.     A descendant can be written where ZeroizeRecord would do nothing.
  274.  
  275.  
  276.     ───────────────────────────────────────────────────────────────────────
  277.  
  278.                              Reserved Field Codes
  279.  
  280.  
  281.     So far, we have only edited strings, integers, and reals.  DMX can be
  282.     used for more data types and several different formats:
  283.  
  284.                 ^ = uppercase string field
  285.                 _ = string field
  286.                 # = numeric string field  (for entering phone numbers)
  287.  
  288.                 c = character field  (or character array)
  289.                 C = character field  (forced uppercase)
  290.                 N = numeric character field (for dBASE-type fields)
  291.                 0 = numeric character field (for entering phone numbers)
  292.  
  293.                 B = byte field
  294.                 W = word field
  295.                 I = integer field
  296.                 L = longint field
  297.                 R = real number field
  298.                 ~ = boolean value field
  299.  
  300.  
  301.         Note:  Lowercase code (for numbers) indicates positive values only.
  302.  
  303.  
  304.     DMX requires these restrictions for the format string:
  305.  
  306.         1.  Do not use more than one type of format character in each field.
  307.         2.  Do not mix the case of format characters within each field.
  308.         3.  When using 'N' fields:  A left parenthesis counts as one digit.
  309.  
  310.  
  311.     ───────────────────────────────────────────────────────────────────────
  312.  
  313.                     PROCEDURE DESCRIPTIONS IN ORDER OF USE
  314.  
  315.  
  316.          DMXwindow contains the screen and data handling facilities.
  317.          DWindow is a descendant object that includes file I/O procedures.
  318.          (DWindow is defined in the file DMX_FILE.PAS)
  319.  
  320.          This is only a quick description of methods and uses.
  321.          It is recommended that programmers examine the sample programs
  322.          that have been provided.
  323.  
  324.  
  325.  
  326. constructor DMXwindow.Init (headerstr,dformat            : string
  327.                             upper,lower, bor,txt,hilite  : word);
  328.  
  329.          HEADERSTR is a title string (eg: to display fieldnames).
  330.          DFORMAT represents the format and appearance of the database.
  331.          UPPER and LOWER are the number of blank lines above
  332.          and below the editing portion of the screen.
  333.          BOR is the color of the field separators and rulers.
  334.          TXT is the color for normal text.
  335.          (A full border is not a function of DMX.)
  336.          HILITE is the color used for the current field.
  337.          The SetScreen procedure can reset these values later.
  338.  
  339.  
  340. DMXwindow.AdjustRecSize (leader,trailer,phantom : integer);
  341.  
  342.          This procedure can be used if LEADER bytes should be ignored
  343.          at the beginning of the record, or TRAILER bytes at the end.
  344.          PHANTOM bytes are those that can be added for virtual methods.
  345.  
  346.          The effects are cumulative, ie:  Calling this procedure twice
  347.          will result in adjusting the record size twice as much.
  348.  
  349.  
  350. Dwindow.LoadDataBlock (var Data;  BuffSize : longint;  var F );
  351.  
  352.          DATA is the data array being loaded.
  353.          BUFFSIZE is the size of the data buffer.
  354.          F is the file variable to use.
  355.          (F must have been ASSIGNed, but can be unopened.)
  356.          This procedure is defined by the DWindow object.
  357.  
  358.  
  359. DMXwindow.OpenBuffer (var Data;  BuffSize : longint);
  360.  
  361.          Sets up and displays the data entry screen.
  362.          Data refers to the data array.
  363.          BUFFSIZE is the size of the data buffer,
  364.          and is retained for EditData and SaveDataBlock.
  365.  
  366.  
  367. DMXwindow.EditData (var Data;  var Key,ext  : char;  KeySet,ExtSet  : alphaset);
  368.  
  369.          DATA is the data array being edited.
  370.          KEY and EXT return the exit key used.
  371.          KEYSET and EXTSET are sets of the key codes that will exit EditData.
  372.          (ALPHASET is a set of characters #0..#255.)
  373.  
  374.  
  375. Dwindow.SaveDataBlock (var Data;  var F );
  376.  
  377.          Checks the changemade variable before saving the data buffer.
  378.          DATA is the data array being saved.
  379.          F is the file variable to use.
  380.          (F must have been ASSIGNed, but can be unopened.)
  381.          This procedure is defined by the DWindow object.
  382.  
  383.  
  384.     ───────────────────────────────────────────────────────────────────────
  385.  
  386.                               THE DMXVIEWER OBJECT
  387.  
  388.  
  389.       DMXviewer is a descendant of DMXwindow that does not allow editing.
  390.       Its use demonstrated in the DMXAMORT.PAS amortization program.
  391.  
  392.  
  393.  
  394.     ───────────────────────────────────────────────────────────────────────
  395.  
  396.                                  VIRTUAL METHODS
  397.  
  398.  
  399.     Virtual methods allow the programmer to expand and customize DMX.
  400.     These procedures and functions should not be called directly by the
  401.     program.  They will be referred to within the DMX unit, automatically.
  402.  
  403.  
  404.  
  405. procedure EvaluateField (RecNum : longint;  CellNum,Line : word);      virtual;
  406.  
  407.          Called internally only after a field has been changed.
  408.          Useful for immediate error checking.
  409.  
  410.  
  411.  
  412. procedure SetUpRecord (RecNum : longint);                              virtual;
  413.  
  414.          Called internally, before editing a record.
  415.          Useful for displaying the current record number.
  416.  
  417.  
  418.  
  419. procedure EvaluateRecord (RecNum : longint;  Line : word);             virtual;
  420.  
  421.          Called internally, after editing a record.
  422.          Useful for error checking.
  423.  
  424.  
  425.  
  426. function  DataAt (RecNum : longint)  : pointer;                        virtual;
  427.  
  428.          Called internally to return a pointer to a record.
  429.          This function can be changed for descendant objects, for
  430.          differently arranged database:
  431.          eg: indexed, relational, linked lists, or other odd formats.
  432.  
  433.          Refer to files DMXdFILE.PAS and DMXAMORT.PAS for different
  434.          implementations of this function.
  435.  
  436.  
  437.     ───────────────────────────────────────────────────────────────────────
  438.  
  439.                                 NON-DMX PROCEDURES
  440.  
  441.  
  442.     These are a few of the procedures used internally by the DMX objects.
  443.     They are used by the demo programs, and are thus documented here.
  444.  
  445.  
  446.  
  447. procedure Screen (Message : string;  Row,Column,Attrib : word);
  448.  
  449.          Performs a fast screen-write.
  450.          MESSAGE is the text to be written; ROW and COL are the position;
  451.          and ATTRIB is the text color.
  452.          This procedure is NOT window-sensitive.
  453.  
  454.  
  455.  
  456. procedure WindBorder (Attrib : word);
  457.  
  458.          Draws a border around the current window.
  459.          ATTRIB is the border color.
  460.  
  461.     
  462.  
  463. procedure ReadNextBlock (var F;  var Data;  BuffSize : word);
  464.  
  465.          This procedure reads DATA from file F.
  466.          F can be a file of any type.
  467.          DATA can be of any type.
  468.          BUFFSIZE is the number of bytes that is read
  469.          (must be less than 65536).
  470.  
  471.  
  472.  
  473. procedure WriteNextBlock (var F;  var Data;  BuffSize : word);
  474.  
  475.          This procedure writes DATA to file F.
  476.          F can be a file of any type.
  477.          DATA can be of any type.
  478.          BUFFSIZE is the number of bytes that is written
  479.          (must be less than 65536).
  480.  
  481.  
  482.  
  483.     ───────────────────────────────────────────────────────────────────────
  484.  
  485.     Trademark acknowledgements:
  486.                 Turbo Pascal is a trademark of Borland International, Inc.
  487.                 dBASE is a trademark of Ashton-Tate.
  488.  
  489.  
  490.