home *** CD-ROM | disk | FTP | other *** search
-
- DMX Data Entry Matrix 2.2
- (C) 1990 Randolph Beck
-
-
- DMX is a Turbo Pascal unit designed to manipulate data entry screens
- in a "browse" format. This is extremely flexible and powerful.
- You can further enhance its usefulness through creative use of object-
- oriented programming.
-
- We have used this system for more than just data entry. DMX can also
- be used to create text listers, tables, smart help screens, and more.
-
- DMX requires Turbo Pascal 5.5 or above.
-
- ───────────────────────────────────────────────────────────────────────
-
- This is a shareware product and may be distributed and copied for free,
- providing that no profit is made through such distribution.
-
- Users can register their copy by sending $12.
-
- Registered users will receive a diskette with:
- An updated version of the DMX TPU files;
- Associated program units;
- Full documentation of its internal functions.
-
- The registered version includes full access to the many internal
- procedures and functions which make this system work.
-
-
- The $12 registered version should suffice for most programmers, but
- registered programmers can also order fully documented source code of
- the DMX2.TPU file for an additional $25. (This can be ordered later.)
-
-
- Business and government organizations are required to register in
- order to continue to use this system.
-
-
- Randolph Beck
- DMX Registration
- P.O. Box 56-0487
- Orlando, FL
- 32856-0487
-
- Please include any questions or comments.
-
-
- ───────────────────────────────────────────────────────────────────────
-
- Files included:
-
- READ.ME This.
-
- DMX2.TPU Main DMX unit (2.2)
- TVIDEO.OBJ Required for compiling with DMX2.TPU
- DMX_FILE.PAS Source code for the file-handling unit
- DMXDFILE.PAS Source code for the dBASE file-handling unit
-
- DMXAMPLE.PAS Source code for the simple example
- DBENTRY.PAS Source code for the dBASE file demo
- DMXAMORT.PAS Source code for the amortization table demo
-
-
- ───────────────────────────────────────────────────────────────────────
-
- What Makes DMX So Easy to Use?
-
-
- After deciding upon your record structures, you can pass this to the
- DMX initialization procedure using a formatting string. This string
- will also determine the display format.
-
- Example:
- A RECORD with a STRING [20], an INTEGER, and a REAL may use this format:
- ' ____________________ | IIII | ($RRR,RRR.RR) '
-
-
- Fields must be delimited by vertical bars ("|"). These will be converted
- into solid lines when displayed.
-
- The data type of each field is determined by the letters in the string.
- There are provisions for most data types, and many different formats.
-
- Programmers only need to alter this one formatting string when changing
- their data structure.
-
-
- ───────────────────────────────────────────────────────────────────────
-
- Getting Started
-
-
- The object is initialized with a formatting string, and another string
- which is used for an optional title.
- Also required are five word-types:
- 1. the number of lines above the data entry area;
- 2. the number of lines below the data entry area;
- 3. border color (used only for field separators);
- 4. text color;
- 5. and the color attributes of the hilighted field.
-
- Example:
- DMXwindow.Init (' Name ref balance ',
- ' ____________________ | IIII | ($RRR,RRR.RR) ',
- 2,0, Cyan,LightCyan,$3F);
-
-
- (Color $3F indicates white foreground and cyan background.)
-
- ───────────────────────────────────────────────────────────────────────
-
- Opening the Data Screen
-
-
- DMX is window-sensitive. Your own program can do the WINDOW procedure
- to change the window position. (A separate border procedure is included
- in this package for creating borders.)
-
- Use the OpenBuffer procedure to set up the screen. This requires two
- parameters: The actual data buffer and the buffer size (in bytes).
-
- The structure of the data in the buffer must be the same as that which
- was specified by the formatting string in the INIT procedure.
- (There are advanced techniques which provide exceptions to most of the
- rules; refer to the AdjustRecSize procedure in the DMXdFILE.PAS example.)
-
- Example:
- DMXwindow.OpenBuffer (DataArray, sizeof (DataArray));
-
-
- ───────────────────────────────────────────────────────────────────────
-
- Editing the Data
-
-
- The EditData procedure will take care of your data editing chores.
- The parameters required are the data buffer (same as in the OpenBuffer
- procedure) and keyboard control information:
- Key and Ext are two char types for returning the last key pressed.
- (If the last key was an extended character, the Key will be #0 and
- the extended code will be returned in Ext.)
- KeySet and ExtSet represents the set of characters that will force
- DMX to exit.
-
- Example:
- DMXwindow.EditData (DataArray, Key,ext, [^C,Esc],[F1,F10]);
-
-
- (Note that 'Esc','F1', & 'F10' are assumed to be the character constants
- that correspond to the character codes for those particular keys.)
-
-
- ───────────────────────────────────────────────────────────────────────
-
- Quick Recap
-
-
- To initialize the object; draw the screen; and edit the data:
-
-
- DMXwindow.Init (' Name ref balance ',
- ' ____________________ | IIII | ($RRR,RRR.RR) ',
- 2,0, Cyan,LightCyan,$3F);
-
-
- DMXwindow.OpenBuffer (DataArray, sizeof (DataArray));
-
-
- DMXwindow.EditData (DataArray, Key,ext, [^C,Esc],[F1,F10]);
-
-
-
-
- ───────────────────────────────────────────────────────────────────────
-
- A Simple Example
-
-
- This is a very simple example. It does not provide a fancy border,
- nor does it include a facility to save the data. It is meant only
- to show how easily a data entry screen can be created.
-
-
- Program DEMO;
- uses Dos,Crt,DMX2;
- type DataRec = record
- S :string [20]; I :integer; R :real;
- end;
- var Key,ext : char;
- DataArray : array [0..99] of DataRec;
- DMXa : Dwindow;
- Begin
- ClrScr;
- Window (18,2,69,22);
-
- FillChar (DataArray, sizeof (DataArray), 0); { clear the database }
-
- DMXa.Init (' Name ref balance ',
- ' ____________________ | IIII | ($RRR,RRR.RR) ',
- 2,1, Cyan,LightCyan,$3F);
-
- DMXa.OpenBuffer (DataArray, sizeof (DataArray));
-
- DMXa.EditData (DataArray, Key,ext, [Esc],[F1,F10]);
-
- ClrScr;
- End.
-
-
- ───────────────────────────────────────────────────────────────────────
-
- File-Handling Procedures
-
-
- Loading and saving data is not directly a function of DMX.
- DMX_FILE.PAS contains Dwindow --which is a descendant object
- of DMXwindow for simple file-handling chores.
-
- Dwindow has two procedures:
-
- Dwindow.LoadDataBlock (DataArray, sizeof (DataArray), F);
-
- Dwindow.SaveDataBlock (DataArray, F);
-
-
- The file variable F must have been previously ASSIGNed.
-
- See DMXdFILE.PAS for examples of these procedures.
-
-
- ───────────────────────────────────────────────────────────────────────
-
- How Can I Make DMX More Powerful?
- Advanced Programming
-
-
- Object-oriented programming is what makes DMX powerful. But we have
- only scratched the surface.
-
- DMX allows Pascal programmers to quickly create a data entry screen.
- Object-oriented programming allows programmers to change DMX itself.
-
-
- For instance: DMX, by itself, only concerns itself with data entry.
- It does not display the current record number in any particular place.
- However, there are several virtual procedures in this object which have
- been reserved for specialized use.
-
- Programmers can create a descendant object with a procedure called:
- SetUpRecord. This procedure is used internally before editing each
- record -- and originally did nothing. A descendant for SetUpRecord
- can display the current record number whereever the programmer decides.
-
-
- Another example: The primary DMX unit requires that the entire database
- should be loaded into an array.
- But this can be circumvented by the DataAt virtual method.
-
- Each time that DMX accesses a record, the location is provided by the
- DataAt function. This function is given a record number to calculate a
- memory address in the data array.
-
- A descendant for the DataAt function can be written to read the
- record from a file, and return a pointer to where it is is stored.
- The example program DBENTRY.PAS works this way.
-
-
- Descendant objects can also be written to remove a feature from DMX.
- The procedure ZeroizeRecord (var RecordData ) is called whenever the
- user presses ^Y.
- A descendant can be written where ZeroizeRecord would do nothing.
-
-
- ───────────────────────────────────────────────────────────────────────
-
- Reserved Field Codes
-
-
- So far, we have only edited strings, integers, and reals. DMX can be
- used for more data types and several different formats:
-
- ^ = uppercase string field
- _ = string field
- # = numeric string field (for entering phone numbers)
-
- c = character field (or character array)
- C = character field (forced uppercase)
- N = numeric character field (for dBASE-type fields)
- 0 = numeric character field (for entering phone numbers)
-
- B = byte field
- W = word field
- I = integer field
- L = longint field
- R = real number field
- ~ = boolean value field
-
-
- Note: Lowercase code (for numbers) indicates positive values only.
-
-
- DMX requires these restrictions for the format string:
-
- 1. Do not use more than one type of format character in each field.
- 2. Do not mix the case of format characters within each field.
- 3. When using 'N' fields: A left parenthesis counts as one digit.
-
-
- ───────────────────────────────────────────────────────────────────────
-
- PROCEDURE DESCRIPTIONS IN ORDER OF USE
-
-
- DMXwindow contains the screen and data handling facilities.
- DWindow is a descendant object that includes file I/O procedures.
- (DWindow is defined in the file DMX_FILE.PAS)
-
- This is only a quick description of methods and uses.
- It is recommended that programmers examine the sample programs
- that have been provided.
-
-
-
- constructor DMXwindow.Init (headerstr,dformat : string
- upper,lower, bor,txt,hilite : word);
-
- HEADERSTR is a title string (eg: to display fieldnames).
- DFORMAT represents the format and appearance of the database.
- UPPER and LOWER are the number of blank lines above
- and below the editing portion of the screen.
- BOR is the color of the field separators and rulers.
- TXT is the color for normal text.
- (A full border is not a function of DMX.)
- HILITE is the color used for the current field.
- The SetScreen procedure can reset these values later.
-
-
- DMXwindow.AdjustRecSize (leader,trailer,phantom : integer);
-
- This procedure can be used if LEADER bytes should be ignored
- at the beginning of the record, or TRAILER bytes at the end.
- PHANTOM bytes are those that can be added for virtual methods.
-
- The effects are cumulative, ie: Calling this procedure twice
- will result in adjusting the record size twice as much.
-
-
- Dwindow.LoadDataBlock (var Data; BuffSize : longint; var F );
-
- DATA is the data array being loaded.
- BUFFSIZE is the size of the data buffer.
- F is the file variable to use.
- (F must have been ASSIGNed, but can be unopened.)
- This procedure is defined by the DWindow object.
-
-
- DMXwindow.OpenBuffer (var Data; BuffSize : longint);
-
- Sets up and displays the data entry screen.
- Data refers to the data array.
- BUFFSIZE is the size of the data buffer,
- and is retained for EditData and SaveDataBlock.
-
-
- DMXwindow.EditData (var Data; var Key,ext : char; KeySet,ExtSet : alphaset);
-
- DATA is the data array being edited.
- KEY and EXT return the exit key used.
- KEYSET and EXTSET are sets of the key codes that will exit EditData.
- (ALPHASET is a set of characters #0..#255.)
-
-
- Dwindow.SaveDataBlock (var Data; var F );
-
- Checks the changemade variable before saving the data buffer.
- DATA is the data array being saved.
- F is the file variable to use.
- (F must have been ASSIGNed, but can be unopened.)
- This procedure is defined by the DWindow object.
-
-
- ───────────────────────────────────────────────────────────────────────
-
- THE DMXVIEWER OBJECT
-
-
- DMXviewer is a descendant of DMXwindow that does not allow editing.
- Its use demonstrated in the DMXAMORT.PAS amortization program.
-
-
-
- ───────────────────────────────────────────────────────────────────────
-
- VIRTUAL METHODS
-
-
- Virtual methods allow the programmer to expand and customize DMX.
- These procedures and functions should not be called directly by the
- program. They will be referred to within the DMX unit, automatically.
-
-
-
- procedure EvaluateField (RecNum : longint; CellNum,Line : word); virtual;
-
- Called internally only after a field has been changed.
- Useful for immediate error checking.
-
-
-
- procedure SetUpRecord (RecNum : longint); virtual;
-
- Called internally, before editing a record.
- Useful for displaying the current record number.
-
-
-
- procedure EvaluateRecord (RecNum : longint; Line : word); virtual;
-
- Called internally, after editing a record.
- Useful for error checking.
-
-
-
- function DataAt (RecNum : longint) : pointer; virtual;
-
- Called internally to return a pointer to a record.
- This function can be changed for descendant objects, for
- differently arranged database:
- eg: indexed, relational, linked lists, or other odd formats.
-
- Refer to files DMXdFILE.PAS and DMXAMORT.PAS for different
- implementations of this function.
-
-
- ───────────────────────────────────────────────────────────────────────
-
- NON-DMX PROCEDURES
-
-
- These are a few of the procedures used internally by the DMX objects.
- They are used by the demo programs, and are thus documented here.
-
-
-
- procedure Screen (Message : string; Row,Column,Attrib : word);
-
- Performs a fast screen-write.
- MESSAGE is the text to be written; ROW and COL are the position;
- and ATTRIB is the text color.
- This procedure is NOT window-sensitive.
-
-
-
- procedure WindBorder (Attrib : word);
-
- Draws a border around the current window.
- ATTRIB is the border color.
-
-
-
- procedure ReadNextBlock (var F; var Data; BuffSize : word);
-
- This procedure reads DATA from file F.
- F can be a file of any type.
- DATA can be of any type.
- BUFFSIZE is the number of bytes that is read
- (must be less than 65536).
-
-
-
- procedure WriteNextBlock (var F; var Data; BuffSize : word);
-
- This procedure writes DATA to file F.
- F can be a file of any type.
- DATA can be of any type.
- BUFFSIZE is the number of bytes that is written
- (must be less than 65536).
-
-
-
- ───────────────────────────────────────────────────────────────────────
-
- Trademark acknowledgements:
- Turbo Pascal is a trademark of Borland International, Inc.
- dBASE is a trademark of Ashton-Tate.
-
-
-