home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / TPGRWNDW.ZIP / WINDOWS.DOC < prev    next >
Encoding:
Text File  |  1993-01-04  |  5.8 KB  |  155 lines

  1.                       Windows Version 1.00
  2.  
  3.  
  4.  
  5.                        By Todd Fiala
  6.  
  7.  
  8.                        Introduction
  9.  
  10.       This set of utilities is for use with Turbo Pascal 5.5.  You must be
  11. running Borland's Graphics System (use InitGraph).  This public domain package
  12. gives you a wide variety of subroutines for use in YOUR programs.  These window
  13. commands are for use in a graphics enviroment.  The only thing not provided is
  14. the actual implementation section for the unit.
  15.  
  16.                    Files contained :
  17.  
  18.                        Windows.doc : This documentary
  19.                        Windows.pas : The Interface section for Windows.tpu
  20.                        Windows.tpu : The Turbo Pascal 5.5 Unit file
  21.  
  22.  
  23.  
  24.                          Using Windows
  25.      To use windows.tpu in your programs, you must first set up the
  26. Borland Graphics system, using a code segment something like this:
  27.  
  28. uses Windows, Graph;
  29. var
  30.    grDriver,
  31.    grMode   : word;
  32.  
  33. begin
  34.   grDriver := Detect;
  35.   InitGraph(grDriver,grMode,'');
  36.   .
  37.   .
  38.   .
  39. end.
  40.  
  41.       For best results, use mode
  42.              VGA     VgaMed
  43.              MCGA    McgaHi
  44.              EGA     EgaHi
  45.              CGA     CgaHi
  46.  
  47.       To set the graphics mode, use
  48.               SetGraphMode(Mode);
  49.  
  50.  
  51.  
  52.  
  53.               Command Summary
  54.  
  55.       This section will explain the use and purpose of each part of
  56. windows.tpu.
  57.  
  58.                       GLOBAL VARIABLES
  59.  
  60. ShowBor : (Boolean)  When drawing any graphics window, if ShowBor is true,
  61.           a border will be drawn around the window. Disable border by typing
  62.           "ShowBor = false"
  63.  
  64. HitKey : (Boolean) This variable controls whether the window will be closed
  65.          after a key is hit or not.  This works with OpenWndw and ShowWndw.
  66.          It is reset to false after all window calls.  When true, the window
  67.          will automatically be closed after the next key is pressed.
  68.  
  69. TextCol : (word) This will be the color of the printed text on your graphics
  70.           windows.  Initially set to 0 (Black text on white background)
  71.  
  72. BackCol : (word) This will be the main window color, the background color for
  73.           the text.  Therefore you do not want to set BackCol = TextCol.
  74.  
  75. BorCol : (word) If ShowBor is True, then a border will be drawn around all
  76.          graphics windows of color BorCol.
  77.  
  78.  
  79.                PROCEDURES AND FUNCTIONS
  80.  
  81.       In Windows.pas, a pretty good explanation for all of these functions and
  82. procedures are given.  This is just to clear up any misconceptions.
  83.  
  84. procedure ClearText
  85.      This will clear the internal window text buffer.  Will not need to be
  86. called unless you specifically want to wipe out what's in the buffer.
  87. (cleared after windows are closed)
  88.  
  89. procedure WriteWndw(AddStr : string)
  90.      WriteWndw will add the text AddStr to the window text buffer.  When a
  91. graphics text window is open (with ShowWndw,CursorWndw, or OpenWndw), the text
  92. in the window text buffer will be printed in the window.
  93.  
  94. procedure SetBuf
  95.      This will set the buffer reader to start reading from the beginning of the
  96. buffer.
  97.  
  98. function ReadBuf(var ch : char) : boolean
  99.      Readbuf returns false if the buffer has been read to the end.  Ch is the
  100. next character it reads from the buffer.
  101.  
  102. function BufEmpty : boolean
  103.      This returns true if the buffer is indeed empty.
  104.  
  105. procedure GraphWndw(x1,y1,x2,y2 : word)
  106.      A window will be opened (close with CloseWndw).  The area behind this
  107. window will be saved.  The window is defined by (x1,y1) upper left, (x2,y2)
  108. lower right.  A border will be drawn if ShowBor is True.
  109.  
  110. function GrPos(TextPos : word) : word
  111.      GrPos returns the text mode equivelant graphics starting position.  For
  112. example, since the standard character is 8 pixels wide, if you say GrPos(2), it
  113. will return 8, because (2-1)*8 = 8.  Remember, text mode positions start at
  114. (1,1) while graphics mode coordinates start at (0,0), hence the (2-1)*8
  115. instead of 2*8.
  116.  
  117. procedure FormatBuffer
  118.      You dont really need to worry about this.  It is used to format the
  119. Window Text Buffer for word wrap and is used by WriteText.
  120.  
  121. procedure WriteText(x1,y,x2 : word)
  122.      This procedure will write the text in the text buffer between (and
  123. including) margins x1 and x2, starting at y. (All are Text Coordinates)
  124.  
  125. procedure OpenWndw(AddString : string; x1,y1,x2,y2 : word)
  126.      OpenWndw will open a window from text coordinates (x1,y1) {upper left}
  127. to (x2,y2) {lower right}.  It will add AddString to the Window Text Buffer and
  128. then write all text to the window after opened.  If HitKey is true, the window
  129. will disappear as soon an a key is hit [useful for information windows].  If
  130. HitKey is false, the window will remain open till closed with CloseWndw.
  131.  
  132. procedure ShowWndw(text : string)
  133.      This is the procedure to use if you don't want to worry about anything and
  134. just print a nice looking window.  It does all the work for you.  It opens a
  135. window as large as needed, centers it on the screen, and uses a nice word wrap.
  136. Uses Hitkey as above.
  137.  
  138. function CursorWndw(AddString : string) : string
  139.      Quite a handy function, it will add the text AddString to the window Text
  140. Buffer and open a window with a prompt line where it prints what you type.  It
  141. will return the string you type, and if Escape is pressed, will return a null
  142. string('').
  143.  
  144. procedure CloseWndw
  145.      This procedure will close the last open window.  If no window is open,
  146. then nothing will happen.
  147.  
  148. procedure ClearAllWndws
  149.      A mop up utility, it will close all the open windows and clear the text
  150. buffer.  Should use to initialize the system.
  151.  
  152.  
  153.               ADDITIONAL NOTES
  154.      If you run a microsoft compatable mouse in your programs, you should
  155. disable any mouse interrupts while calling window procedures, or errors WILL
  156. occur.