home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / TURBOPAS / MULTIMAP.ZIP / MULTIMAP.DOC < prev    next >
Encoding:
Text File  |  1985-10-03  |  9.0 KB  |  190 lines

  1.     The procedures in Multimap.Box are intended to facilitate the handling of 
  2. display and data entry screens on an IBM-XT with the Color Graphics Adapter, 
  3. DOS 2.0, and Turbo Pascal.  Any compatibility with other personal computer is 
  4. strictly coincidental. However, any work-alike machine should be able to 
  5. handle these routines.  
  6.  
  7.     Fields are "Mapped" onto the screen according to specified parameters.  
  8. Fields that can be updated have control records built in the Heap.  These 
  9. dynamic records are in the form of a circular linked list.  Cursor control 
  10. and positioning are supported.  Up to 8 video pages in 40 column mode and 4 
  11. pages in 80 column mode are supported and may be processed simultaneously.  
  12.  
  13.     The primary procedures intended for use are as follows:
  14.  
  15. * Map(Text, Page, Line#, Column#, Foreground, Background);
  16.  
  17.     This procedure will write TEXT on page PAGE at line number LINE# and 
  18. column number COLUMN# in foreground color FOREGROUND and background color 
  19. BACKGROUND.  This procedure DOES NOT record any information about the text 
  20. that is written (ie. this is not for updateable fields).
  21.  
  22.     TEXT is defined as a String[80].
  23.  
  24.     PAGE is a valid video page.  Video pages are numbered 0 to 7 in 40 column 
  25. mode and 0 to 3 in 80 column mode.
  26.     In 80 column mode if you specify a page greater then 3 the text will wrap 
  27. around to video page PAGE-4.  Thus pages 0 and 4 are the same, as are pages 1 
  28. and 5, 2 and 6, and 3 and 7.  It is therefore possible to define two distinct 
  29. areas on a given video page.
  30.  
  31.     Line# is a value between 1 and 25.
  32.  
  33.     Column# is a value between 1 and 80.
  34.  
  35.     Foreground and Background are byte values.  If the value for a foreground 
  36. or a background color is within the range of valid colors then the display 
  37. color will be changed to the specified color.  If the value is not within the 
  38. range then the current colors will be used.  See the Turbo Reference manual 
  39. for the range of valid colors.
  40.  
  41.  
  42. * Init_Paging;  (No Parameters) 
  43.  
  44.     Must be called once before any "Mapu's" (described below) are called.
  45. This procedure initializes a table of pointer values to Nil preparing the 
  46. table for the subsequent recording of pointers values.
  47.  
  48. * MapU(Text, Page, Line#, Column#, Foreground, Background);
  49.  
  50.     This procedure is similar to MAP (above) and the parameters function the 
  51. same.  The difference is that this procedure DOES record information about 
  52. this field in a record on the Heap.  The Text will be displayed on the video 
  53. page but not recorded in the field record, therefore TEXT is an initial value
  54. such as underscores or X's.  The number of characters in the initial value 
  55. determines the maximum size of the field.
  56.  
  57. * ReadMap(Page, Field);
  58.  
  59.     After you have created a page with Map and MapU you are ready to allow
  60. the user to enter data on the screen. ReadMap is the procedure that does 
  61. this.  
  62.  
  63.     Page is the page that you wish to process.
  64.  
  65.     Field is an Integer value indicating the number of the field that you 
  66. initially want the cursor to be positioned at.  Fields are numbered in the 
  67. same order as they are MapU'ed, hence the first field that is MapU'ed is Field 
  68. 1, the second field MapU'ed is Field 2, and the Nth field Mapu'ed is Field N.  
  69. This is handy if there is a data entry error in a field: you can position the 
  70. cursor at the field in error.  Most times you will specify Field=1.
  71.  
  72.     Upon calling ReadMap several things happen.  First, the specified video
  73. page is displayed. Then the cursor is positioned at the field specified.  If
  74. there is an error locating the record for this field an error message is 
  75. displayed.  Now the user is ready to enter data onto the screen.  Characters 
  76. are displayed as they are typed and are also recorded in the field record in 
  77. the heap.  When the cursor reaches the end of a field it will jump to the next
  78. field.  Pointers are updated to reflect the new field and processing continues 
  79. with this field.
  80.  
  81.     There are several cursor positioning keys at the user's disposal:
  82.  
  83.          Tab or Shift Tab positions the cursor at the next or previous field.
  84.  
  85.          Baskspace is defined to function the same as Shift Tab (there is no
  86.              destructive backspace).
  87.  
  88.          The Home key will position the cursor at the first field.
  89.  
  90.          The End key will position the cursor at the last field.
  91.  
  92.          The left and right arrow keys move the cursor once space to the left 
  93.          or right.  When the cursor reaches the end or beginning of a field it
  94.          will jump to the next field.
  95.  
  96.          The up and down arrow keys will move the cursor to the first field on 
  97.          the next or previous line.
  98.  
  99.          The Delete key will delete the character at the cursor position.
  100.  
  101.          The Insert key will insert one space at the cursor position.
  102.  
  103.     After calling ReadMap there are only three ways to leave the procedure:
  104.  
  105.     1.  A global Boolean variable called Functionkey_Pressed will be true.
  106.         If this is the case then a global Byte variable called Functionkey
  107.         will contain the number of the function key that was pressed.  Valid
  108.         values will be from 1 to 40.  The extended function key values are
  109.         obtained by pressing the Shift, Ctrl, or Alt key with a function key.
  110.  
  111.     2.  A global Boolean variable called Escape will be true.  Indicating that
  112.         the Esc key was pressed.
  113.  
  114.     3.  A local Boolean variable called Return will be true.  If it's not
  115.         Escape or Functionkey_Pressed then it had to be the return key.
  116.  
  117. *  some_variable := Get_Data( Page, Field);
  118.  
  119.     During the ReadMap procedure all data entered is stored on the heap.
  120. Upon leaving Readmap it will be necessary to retrieve the data and possibly
  121. store it in a record somewhere.  This is what Get_Data does.  Get_Data is
  122. a function and must be used in an assignment statement.  Some_Variable should 
  123. be defined as a String variable.  The length may not be greater than 80 
  124. characters.  Page is the page number of a valid page.  Field is an Integer
  125. expression indicating the number of the field that you want to retrieve (see
  126. ReadMap about how fields are numbered).  
  127.  
  128. Hint:  While numbers are used to indicate which field to retrieve, this does 
  129.        leave something to be desired in the area of readability in your source 
  130.        code.  If you define a type however, that contains names in the same 
  131.        order as the fields are MapU'ed, then you can use the Ordinal value of 
  132.        the name as the field number.
  133.  
  134.        Example:   Type Page1_Names = (Dummy,First,Middle,Last);
  135.                   Begin 
  136.                    (* MapU's go here *)
  137.                    First_Name := Get_Data(1,ord(First));
  138.                   End;
  139.  
  140.        There must be a dummy value as the first value for the type because
  141.        ordinal values start at zero but the Field records are number from 
  142.        one.
  143.  
  144. * DisplayPage( Page );
  145.  
  146.     Immediately displays the specified video page.
  147.  
  148. * Cursorsize(Start, Stop);
  149.  
  150.     Controls the appearance of the cursor.  Start is the beginning scan line.  
  151. Stop is the ending scan line.  Scan line are numbered 0 to 7 starting at the
  152. top.  A normal cursor is (6,7).  To hide the cursor use (8,0).
  153.  
  154. * ClearPage( Page, Color);
  155.  
  156.     Erases a video page and establishes a background color.  
  157.     Page is a valid video page.
  158.     Color is a valid background color.
  159.  
  160. * Reset_Page( Page );
  161.  
  162.     Use this to clean up the heap or to prepare to reuse a page that has been
  163.     MapU'ed.  This procedure disposes of all records for the specified page
  164.     from the Heap and sets this pages pointers, in the pointer table, to Nil.
  165.     Other pages information is not changed.
  166.  
  167. The program Testmap.pas illustrates some of the techniques described here.
  168. Compile it, run it, see if you like it.
  169.  
  170. NOTE:
  171.  
  172.     These routines are supplied as is, without warranty of any kind either
  173.     expressed or implied.   The user is responsible as to the fitness and
  174.     applicability of these routines to their particular application and/or
  175.     hardware.  The supplier of these routines can not be held liable for
  176.     consequential or inconsequetial damages or loss of data.
  177.  
  178.     Limited assistance is available through the TechMail Bulletin Board at
  179.     (703) 430-2535.  Leave a message, comment or suggestion.
  180.  
  181.     You may copy and distribute these routines provided that no portion is
  182.     altered in any way.
  183.  
  184.     If you find that these routines are beneficial and useful to you,
  185.     please support continued development by sending a contribution ($10 - $20)
  186.     to:      
  187.          Terry Zuch
  188.          P.O. Box 10371
  189.          Harrisburg, Pa.  17105-0371
  190.