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

  1. UNIT BlueBag;
  2.  
  3. {This is a unit of handy procedures compiled for Turbo Pascal version 4.
  4.  You have routines available for date arithmetic, modifying the cursor,
  5.  CRT tricks, string processing, testing printer status, and multiple
  6.  overlapping windows. The interface and dependencies are noted below
  7.  together with an explanation of each routine.}
  8.  
  9. INTERFACE
  10.  USES Crt,DOS;
  11.  
  12. TYPE
  13.  DateType=STRING[6];       {'YrMoDy' format for date functions}
  14. CONST
  15.  IsColor: BOOLEAN=True; {Display mode at startup}
  16.  Single : BYTE=1;   {Single and Double are the usual constants for drawing the}
  17.  Double : BYTE=2;   {box around the window.}
  18.  RAM    : BYTE = 0; {windows t/b saved to the heap}
  19.  Disk   : BYTE = 1; {windows t/b saved to logged disk}
  20.  
  21. VAR
  22.  StartScan,
  23.  StopScan  : BYTE;         {Cursor shape at startup}
  24.  
  25. PROCEDURE CLEAR(X1,Y1,X2,Y2:INTEGER);
  26.     {Clears a section of the screen from X1,Y1 to X2,Y2}
  27. PROCEDURE CursorOn;
  28.     {Sets cursor to default state}
  29. PROCEDURE CursorOff;
  30.     {Turns off the cursor after saving its shape to Start/StopScan}
  31. FUNCTION  IncDate(Base:DateType;Delta:LONGINT):DateType;
  32.     {Incriments/decriments Base date by Delta days returning DateType}
  33. FUNCTION  DaysBetween(Early,Late:DateType):LONGINT;
  34.     {Returns the days between early and late dates as a longint}
  35. PROCEDURE DrawBox(X1,Y1,X2,Y2,LineStyle:BYTE);
  36.     {Draws box defined by coordinate the parameters. LineStyle is Single,
  37.      Double, or ASCII 32..254}
  38. FUNCTION  IsBlank(TestStr:STRING):BOOLEAN;
  39.     {Returns True if string is null or blank, False is at least 1 CHAR}
  40. PROCEDURE NoBlanks(VAR HasBlanks:STRING);
  41.     {Removes all spaces from a string}
  42. FUNCTION  OnFile(FileName:STRING):BOOLEAN;
  43.     {Returns True if specified \path\filename exists, else False}
  44. FUNCTION  PrinterOnLine(LPTnum:WORD):BOOLEAN;
  45.     {Returns True if printer is on-line}
  46. PROCEDURE RestoreCursor;
  47.     {Restores cursor to its shape before modification}
  48. PROCEDURE RestoreVideo;
  49.     {Restores video attribute to status before ReverseVideo call}
  50. PROCEDURE ReverseVideo;
  51.     {Displays text in reverse video}
  52. PROCEDURE SetCursor(ScanStart,ScanStop:BYTE);
  53.     {You can set the cursor start and stop scan lines to alter the
  54.      cursor shape. EG: SetCursor(0,StopScan) displays block cursor}
  55. PROCEDURE Space(Spaces:INTEGER);
  56.     {Writes Spaces number of blanks to CRT}
  57. FUNCTION  Trim(LongLine:STRING):STRING;
  58.     {Removes leading and trailing blanks from a string}
  59. FUNCTION  UpperCase(S:STRING):STRING;
  60.     {Returns string in uppercase - (linked *.OBJ code)}
  61. PROCEDURE WAIT;
  62.     {Turns off cursor, Prints "Press any key to continue", and waits
  63.      for any key t/b touched before turing cursor back on.}
  64.  
  65.  
  66. {window procedures:}
  67.  
  68. PROCEDURE OpenWindow(TX,TY,BX,BY,FRG,BKG,Border : BYTE;
  69.                      Heading                    : STRING;
  70.                      WhereSaved                 : BYTE);
  71.     {Saves the previous video image within the square defined by
  72.      TX,TY (top left) to BX,BY (bottom right) to RAM or DISK. A
  73.      border of style BORDER (1,2,#32..254) is drawn in the FRG
  74.      (TextColor) on BKG (TextBackground) colors and the HEADING
  75.      is printed centered at the top of the box. A window is opened
  76.      within the box and filled with BKG color.}
  77. PROCEDURE CloseWindow;
  78.     {Closes the last window opened by OpenWindow and restores to pre-
  79.      vious image. To close all the windows keep calling this procedure
  80.      until they are all closed}
  81.  
  82. Notes on windows: 
  83.     10 windows can be open at any time (the natural screen plus nine
  84. "overlaid" windows). You can have some windows saved to RAM and others to
  85. DISK -- it doesn't matter; The CloseWindow procedure will find and restore
  86. the image automaticly.
  87.     Do not mix these window procedures and the native TP Window() pro-
  88. cedure as you will not get the expected results.
  89.  
  90.  
  91. Please feel free to use and share this unit. I will be happy to send you
  92. the source code for this BlueBag.tpu and the AtSayGet.tpu for the small
  93. cost of $10.oo Canadian / $8.50 U.S. If you wish the code please WRITE to:
  94.  
  95.  (in Canada)                  (in U.S.A.)
  96.  
  97. John Roncalio                John Roncalio
  98. BlueRibbon Software          BlueRibbon Software
  99. 34439 Ascott Avenue          603 Cherry Street, P.O. Box 432
  100. Abbotsford, B.C.             Sumas, Washington
  101. V2S 4V6                      98295
  102.