Program PTOOLWI3;  {Copyright  R D Ostrander
                               Ostrander Data Services
                               5437 Honey Manor Dr
                               Indianapolis  IN  46241

     This is a demonstration program for the Turbo Pascal subroutine PTOOLWIN
     for window manipulations. Address any questions to the author at the
     above address.

     This demonstrates Version 3.0 of PTOOLWIN.INC aka PTOOLWI3.INC         }


VAR

   ScreenType, Ans : Char;

{ Constant Values (Parameters) That must be included in your source program }

CONST

   PTOOLWIN_Number_of_Windows = 10;    { This determines the number of      }
                                       { windows that may be set with the   }
                                       { PTWSet procedure.                  }
                                       { It also determines the number of   }
                                       { windows that may be open at any    }
                                       { one time.                          }

{$I PTOOLWI3.INC}  {Include statement for PTOOLWIN functions and parameters }

{ Internal Routines Begin Here ****************************** }


Procedure NewScreen;

Var
   Screen, Code : Integer;

Begin
     Val (Ans, Screen, Code);
     If (Code = 0) and
        (Screen in [1..9]) then
        If (PTOOLWIN_Stack_Size = 9) or
           ((MaxAvail > 0) and (MaxAvail < 4006)) then
           Begin
                PTWOpen (10);
                ClrScr;
                Gotoxy (20,1);
                Write ('This demonstration program only allows 9 windows.');
                Gotoxy (20,3);
                Write ('I will now close the previous window');
                Delay (3000);
                PTWClose;
                PTWClose;
           End
        else
           Begin
                PTWOpen (Screen);
                ClrScr;
           End;
End;


{ Main Program Begins Here ********************************** }


BEGIN

 ClrScr;
 Gotoxy (15,7); Write ('Demonstration of PTOOLWIN procedure.');
 Gotoxy (15,9); Write ('PTOOLWIN and this program are copyrights');
 Gotoxy (15,10); Write ('of R D Ostrander');
 Gotoxy (15,11); Write ('   Ostrander Data Services');
 Gotoxy (15,12); Write ('   5437 Honey Manor Dr');
 Gotoxy (15,13); Write ('   Indianapolis  IN  46241');
 Gotoxy (15,14); Write ('and have been placed in the public domain.');

 ScreenType := ' ';
 Ans        := ' ';

 Gotoxy (10,23);
 Write ('Would you like to have this program run in Color? (Y/N)');
 Gotoxy (10,24);
 Write ('Some Monochrome cards will show shades of grey.        ');
 While not (ScreenType in ['Y', 'N']) do
       Begin
            Read (KBD, ScreenType);
            Write (ScreenType);
            ScreenType := UpCase (ScreenType);
       End;

 If ScreenType = 'Y' then
    Begin
         PTWSet (1, 2, 3, 31, 9, 1, 0, 15);
         PTWSet (2, 7, 4, 73, 21, 2, 1, 14);
         PTWSet (3, 40, 1, 80, 25, 0, 2, 13);
         PTWSet (4, 1, 8, 80, 16, -1, 3, 12);
         PTWSet (5, 8, 12, 55, 24, -2, 4, 7);
         PTWSet (6, 1, 10, 45, 20, 1, 5, 12);
         PTWSet (7, 5, 5, 75, 10, 2, 6, 9);
         PTWSet (8, 40, 11, 70, 24, 0, 15, 0);
         PTWSet (9, 1, 1, 80, 25, -2, 1, 10);
         PTWSet (10, 1, 21, 80, 25, -2, 4, 0);
    End
 else
    Begin
         PTWSet (1, 2, 3, 31, 9, 0, 15, 0);
         PTWSet (2, 7, 4, 73, 21, 1, 0, 15);
         PTWSet (3, 40, 1, 80, 25, 2, 0, 15);
         PTWSet (4, 1, 8, 80, 16, -1, 0, 15);
         PTWSet (5, 8, 12, 55, 24, -2, 0, 15);
         PTWSet (6, 1, 10, 45, 20, 1, 15, 0);
         PTWSet (7, 5, 5, 75, 10, 2, 0, 15);
         PTWSet (8, 40, 11, 70, 24, -1, 0, 15);
         PTWSet (9, 1, 1, 80, 25, -2, 0, 15);
         PTWSet (10, 1, 21, 80, 25, 2, 15, 0);
    End;

 While Ans <> 'E'do
       Begin
            If Ans <> 'C' then
               Begin
                    Gotoxy (2,2); Write ('Pick a screen - 1 to 9');
                    Gotoxy (2,3); Write (' or "C" to close a screen');
                    Gotoxy (2,4); Write (' or "E" to End           ');
               End;
            Read (KBD, Ans);
            Write (Ans); Gotoxy (WhereX - 1, WhereY);
            Ans := UpCase (Ans);
            If (Ans = 'C') and (PTOOLWIN_Stack_Size > 0) then PTWClose;
            If Ans in ['1'..'9'] then NewScreen;
       End;

Window (1,1,80,25);
ClrScr;
Gotoxy (1,24);
TextColor(0);
TextBackground (15);

END.
