home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / turbopas / pstui100.zip / DEMO1.PAS next >
Pascal/Delphi Source File  |  1993-05-01  |  20KB  |  526 lines

  1. {
  2.  
  3.                                                       ╔══════════════════╗
  4.                                                       ║   PTUI  Demo     ║
  5.                                                       ║                  ║
  6.                                                       ║    Rev. 1.00     ║
  7.                                                       ╚══════════════════╝
  8.  
  9. }
  10.  
  11. Program Demo;
  12.  
  13. {$F-} {$O-} {$A+} {$G-}
  14. {$V-} {$B-} {$X-} {$N+} {$E+}
  15.  
  16. {$I FINAL.PAS}
  17.  
  18. {$IFDEF FINAL}
  19.   {$I-} {$R-}
  20.  
  21.   {$IFDEF VER70}
  22.     {$Q-} {$P-}
  23.   {$ENDIF}
  24.  
  25.   {$D-} {$L-} {$S-}
  26.   {$M 8192,262144,655360}
  27. {$ELSE}
  28.   {$M 8192,0,655360}
  29. {$ENDIF}
  30.  
  31. Uses CRT,Strings,PTUI,PTUIVCRT,KeyDef;
  32.  
  33. Procedure BusyExample;
  34.  
  35. Var
  36.   Pop   :TextWindow;
  37.   X     :Word;
  38.  
  39. Begin
  40.   Pop.Open(44,5,72,11,White,LightGrey,Black,Black,NoLine,Solid);
  41.   {Open a Window, Solid Colour, No Line}
  42.   Pop.NewHeading('Working',CentreText,White,Green);
  43.   {Use the heading 'Working', centre the white on green text}
  44.   Pop.Lock;
  45.   {Use relative coordinates, GotoXY(1,1) is now (44,5)}
  46.   VideoColor(White,LightGrey);
  47.   GotoXY(10,4);
  48.   WriteStr('Not Really');
  49.   {Display message in window - Notice, WriteStr instead of Write}
  50.  
  51.   For X:=1 to 366 do         {Our scale is 0 to 366}
  52.   Begin
  53.     Barometer(3,6,25,#219,X,366);       {Draw updated barometer}
  54.     Delay(10);                          {Pretend to do something}
  55.   End;
  56.  
  57.   Pop.UnLock;
  58.   {Must do this - Reset coordinates}
  59.   Pop.Close;
  60.   {Must do this - release memory from heap}
  61. End;
  62.  
  63. Var
  64.   Win       :Array [1..2] of TextWindow;                 {2 Windows}
  65.   WinBut    :Array [1..2] of Array [1..7] of Word;       {2x7 Buttons}
  66.   NewSlide  :SlideBarInfo;                               {A Slide Bar Info}
  67.   DelBut,
  68.   ActiveWin :Byte;
  69.   St        :String;
  70.  
  71.   MX,MY     :Word;
  72.   MB        :Byte;
  73.   Held,
  74.   Doubled,
  75.   Special   :Boolean;
  76.   Key       :Char;
  77.  
  78.   SmoothX,
  79.   SmoothY   :Byte;
  80.  
  81.   TestGet,
  82.   Param     :String;
  83.  
  84. Begin
  85.   If ParamCount>0 Then
  86.     UpperCase(ParamStr(1),Param)
  87.   Else
  88.     Param:='';
  89.  
  90.   If Pos('?',Param)>0 Then
  91.   Begin
  92.     WriteLn('Use /C for CGA, /E for EGA or /V for VGA.  /V is the default.');
  93.     WriteLn('If you have a mono card, this will be detected automatically.');
  94.     WriteLn;
  95.     WriteLn('If you have a TSeng Super VGA, use /S.  Other Super VGA''s: See Docs.');
  96.     Halt;
  97.   End;
  98.  
  99.   If (Card=ColorCard) Then
  100.   Begin
  101.     If Pos('/E',Param)>0 Then                           {EGA?}
  102.     Begin
  103.       VideoCard[ColorCard].CharacterHeight:=14;         {Set Character Size}
  104.       EnableVScreen(EGA);
  105.       VideoCard[Card].ScrollMethod:=ScrollMethod3;      {EGA Scroll}
  106.     End;
  107.     If (Pos('/V',Param)>0) Or (Param='') Then           {VGA?}
  108.       EnableVScreen(VGA);
  109.     If Pos('/S',Param)>0 Then                           {SVGA?}
  110.     Begin
  111.       VideoCard[Card].CardType:=SVGA;
  112.  
  113.       {***********************************************************}
  114.  
  115.                     { Put your SVGA mode number below}
  116.  
  117.       {***********************************************************}
  118.  
  119.       TextMode($26,0,0,0);
  120.  
  121.       {***********************************************************}
  122.  
  123.       EnableVScreen(SVGA);
  124.       VideoCard[Card].ScrollMethod:=ScrollMethod2;      {SVGA Scroll}
  125.     End;
  126.     If Pos('/C',Param)=0 Then
  127.       SetVirtualScreen(160,70);                         {Nice big screen}
  128.   End;
  129.  
  130.   TestGet:='';
  131.   PushCursorSize;               {Save the DOS cursor Size}
  132.   CursorSize($20,$20);          {Kill the cursor (fails on old VGA's)}
  133.   Cursor:=False;                {Don't update cursor position - save time}
  134.   Mouse.Init(True);             {Check for a Mouse}
  135.   InstallVScreenMouse;          {Install Internal Mouse Driver}
  136.   TextBackground(Blue);
  137.   TextColor(Yellow);
  138.   ClrScr;                       {We've set everything up now, Clear Screen}
  139.   GotoXY(2,2);
  140.   WriteStr(#7+' Click here to exit or press [Esc] to exit.');
  141.   GotoXY(4,3);
  142.   WriteStr('Swap between windows with Right Mouse Button or [Tab].  [E] tests the string editor.');
  143.   GotoXY(4,4);
  144.   WriteStr('Mouse users can drag the window by holding on to the heading and moving the mouse.');
  145.   GotoXY(4,5);
  146.   WriteStr('Keyboard users (no mouse) can use [Ctrl][F5] and the cursor keys, followed by [Return].');
  147.   GotoXY(4,6);
  148.   WriteStr('Use the mouse or [Ctrl][PgUp] [PgDn] [Left] [Right] to scroll across the VGA virtual screen.');
  149.  
  150.   Window(40,10,130,30);
  151.   WriteStrLn('                                       ▄▄');
  152.   WriteStrLn('  ██████▄ █████████  ██    ██  ██ ██   ▐█▌  ▄████▄  █████▄  █████████');
  153.   WriteStrLn(' ▐█▌   ▐█▌   ▐█▌    ▐█▌   ▐█▌ ▐█▌ ██    ██ ██▀  ▀▀ ▐█▌   █▌    ▐█▌');
  154.   WriteStrLn(' ██   ▄██    ██     ██    ██  ██  ██   ▐█▌▐█▌      ██ ▄▄█▀     ██');
  155.   WriteStrLn(' ██████▀     ██     ██    ██  ██  ██   ██ ██       ██ ██       ██');
  156.   WriteStrLn('▐█▌         ▐█▌    ▐█▌   ▐█▌ ▐█▌  ██ ▄██  ██▄  ▄▄ ▐█▌  ██     ▐█▌');
  157.   WriteStrLn('██          ██      ▀██████  ██   ████▀    ▀███▀  ██   ▀██    ██');
  158.   Window(1,1,VideoCard[Card].XSize,VideoCard[Card].YSize);
  159.  
  160.   SmoothX:=VideoCard[ColorCard].CharacterLength Div 8;
  161.   SmoothY:=VideoCard[ColorCard].CharacterHeight Div 8;
  162.  
  163.   {Work out how many pixels to smooth scroll}
  164.  
  165.   DelBut:=1;    {Smooth Scroll Temp Variable}
  166.   While (DelBut<30) And (Not KeyPressed) do
  167.   Begin
  168.     Inc(DelBut);
  169.  
  170.     If Not KeyPressed Then
  171.     Begin
  172.  
  173.       ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength + SmoothX,
  174.                    (VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
  175.  
  176.       ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength + SmoothX*3,
  177.                    (VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
  178.  
  179.       ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength + SmoothX*5,
  180.                    (VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
  181.  
  182.       ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength + SmoothX*7,
  183.                    (VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
  184.     End;
  185.  
  186.     ScreenOrigin((VideoCard[Card].SX1) * VideoCard[Card].CharacterLength,
  187.                  (VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
  188.  
  189.     {The lazy man's ^KC smooth scroll  ;-)}
  190.  
  191.   End;
  192.  
  193.   ScreenOrigin(0,0);
  194.  
  195.   Win[1].Open(10,10,50,20,Yellow,Green,Blue,Magenta,NoLine,Solid);
  196.   Win[1].NewHeading('Window 1',CentreText,Yellow,Red);
  197.   Win[1].HeadingIcon(True);  {Make the heading a button to drag window}
  198.  
  199.   NewSlide.X1:=48;
  200.   NewSlide.Y1:=13;
  201.   NewSlide.X2:=48;              {Setup information for our vertical slide bar}
  202.   NewSlide.Y2:=19;
  203.   NewSlide.Forg:=Yellow;
  204.   NewSlide.Back:=Green;
  205.   NewSlide.MainChar:='░';
  206.   NewSlide.ButtonChar:='▓';
  207.   NewSlide.UpLeftChar:=#$18;
  208.   NewSlide.DownRightChar:=#$19;
  209.   NewSlide.CurPos:=0;
  210.   NewSlide.MaxPos:=99;
  211.  
  212.   Win[1].VertSlideBar(NewSlide);        {Activate the slide bar}
  213.  
  214.   NewSlide.X1:=12;
  215.   NewSlide.Y1:=19;
  216.   NewSlide.X2:=47;
  217.   NewSlide.Y2:=19;                      {More exciting information}
  218.   NewSlide.UpLeftChar:=#$1B;
  219.   NewSlide.DownRightChar:=#$1A;
  220.  
  221.   Win[1].HorzSlideBar(NewSlide);        {Setup the Horizontal Slide Bar}
  222.  
  223.   Win[1].VertSlideIcon(True);           {Turn the Slide Bars into Buttons}
  224.   Win[1].HorzSlideIcon(True);
  225.  
  226.  
  227.   {Okay, this part is done the 'easy' way.  I could setup a linked list
  228.    of buttons and check for them but rather I'm going to add them to
  229.    each window.}
  230.  
  231.   Win[1].Buttons.Add(2,2,2,2,False,#27);  {Add the Close Application Button, [Esc]=#27}
  232.   WinBut[1][1]:=Win[1].Buttons.Number;    {Remember the button number}
  233.   Win[1].Buttons.Add(0,0,0,0,False,#9);   {0,0,0,0 for Key PressOnly, No Mouse Equivalent}
  234.   WinBut[1][2]:=Win[1].Buttons.Number;    {These are allocated 'randomly'}
  235.   Win[1].Buttons.Add(0,0,0,0,SpecialCode(Key_Ctrl,Key_Right),KeyCode(Key_Ctrl,Key_Right));
  236.   WinBut[1][3]:=Win[1].Buttons.Number;
  237.   Win[1].Buttons.Add(0,0,0,0,SpecialCode(Key_Ctrl,Key_Left) ,KeyCode(Key_Ctrl,Key_Left));
  238.   WinBut[1][4]:=Win[1].Buttons.Number;
  239.   Win[1].Buttons.Add(0,0,0,0,SpecialCode(Key_Ctrl,Key_PgUp) ,KeyCode(Key_Ctrl,Key_PgUp));
  240.   WinBut[1][5]:=Win[1].Buttons.Number;
  241.   Win[1].Buttons.Add(0,0,0,0,SpecialCode(Key_Ctrl,Key_PgDn) ,KeyCode(Key_Ctrl,Key_PgDn));
  242.   WinBut[1][6]:=Win[1].Buttons.Number;
  243.  
  244.   {We now do the same and open a second window}
  245.  
  246.   Win[2].Open(15,15,60,23,Green,LightGrey,Blue,Red,NoLine,Solid);
  247.   Win[2].NewHeading('Window 2',CentreText,Blue,Green);
  248.   Win[2].HeadingIcon(True);
  249.  
  250.   Win[2].Lock;
  251.   VideoColor(Black,LightGrey);
  252.   GotoXY(16,6);
  253.   WriteStr('PTUI Demo Program');
  254.   Win[2].UnLock;
  255.  
  256.   Win[2].Buttons.Add(2,2,2,2,False,#27);
  257.   WinBut[2][1]:=Win[2].Buttons.Number;
  258.   Win[2].Buttons.Add(0,0,0,0,False,#9);
  259.   WinBut[2][2]:=Win[2].Buttons.Number;
  260.   Win[2].Buttons.Add(0,0,0,0,SpecialCode(Key_Ctrl,Key_Right),KeyCode(Key_Ctrl,Key_Right));
  261.   WinBut[2][3]:=Win[2].Buttons.Number;
  262.   Win[2].Buttons.Add(0,0,0,0,SpecialCode(Key_Ctrl,Key_Left) ,KeyCode(Key_Ctrl,Key_Left));
  263.   WinBut[2][4]:=Win[2].Buttons.Number;
  264.   Win[2].Buttons.Add(0,0,0,0,SpecialCode(Key_Ctrl,Key_PgUp) ,KeyCode(Key_Ctrl,Key_PgUp));
  265.   WinBut[2][5]:=Win[2].Buttons.Number;
  266.   Win[2].Buttons.Add(0,0,0,0,SpecialCode(Key_Ctrl,Key_PgDn) ,KeyCode(Key_Ctrl,Key_PgDn));
  267.   WinBut[2][6]:=Win[2].Buttons.Number;
  268.   Win[2].Buttons.Add(0,0,0,0,False,'E');
  269.   WinBut[2][7]:=Win[2].Buttons.Number;
  270.  
  271.   BusyExample;  {Demo the Barometer}
  272.  
  273.   Mouse.Show;   {Show the mouse - can only show it while we are not}
  274.                 {writing to the screen}
  275.  
  276.   ActiveWin:=2; {Let's start with window 2}
  277.  
  278.   Repeat
  279.     Win[ActiveWin].Buttons.WaitForClick(MX,MY,MB,Held,Doubled,Special,Key);
  280.  
  281.     {Wait for the user to click on one of the buttons in the active window}
  282.  
  283.     If (MB=MouseRightButton) Or ((Key=#9) And (Not Special)) Then
  284.          {If the right button or tab was pressed}
  285.     Begin
  286.       If ActiveWin=1 Then
  287.       Begin
  288.         Win[1].Hide;
  289.         Win[2].Hide;
  290.         Win[1].Show;
  291.         Win[2].Show;
  292.         ActiveWin:=2;
  293.       End
  294.       Else
  295.       Begin
  296.         Win[2].Hide;     {Hide the window on top}
  297.         Win[1].Hide;     {Hide the last window}
  298.         Win[2].Show;     {Show the second window}
  299.         Win[1].Show;     {Now the first one is on top}
  300.         ActiveWin:=1;
  301.       End;
  302.     End;
  303.  
  304.     {If user selects the [Ctrl][Right] key and is not at the end of
  305.      the screen}
  306.  
  307.     If (Special=SpecialCode(Key_Ctrl,Key_Right)) And
  308.        (Key=KeyCode(Key_Ctrl,Key_Right)) And
  309.        (VideoCard[Card].SX2<VideoCard[Card].XSize) Then
  310.     Begin
  311.       If Not KeyPressed Then
  312.       Begin
  313.  
  314.         ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength + SmoothX,
  315.                      (VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
  316.  
  317.         ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength + SmoothX*3,
  318.                      (VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
  319.  
  320.         ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength + SmoothX*5,
  321.                      (VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
  322.  
  323.         ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength + SmoothX*7,
  324.                      (VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
  325.       End;
  326.  
  327.       ScreenOrigin((VideoCard[Card].SX1) * VideoCard[Card].CharacterLength,
  328.                    (VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
  329.  
  330.       {The lazy man's ^KC smooth scroll  ;-)}
  331.  
  332.     End;
  333.  
  334.     {Check for [Ctrl][Left]}
  335.  
  336.     If (Special=SpecialCode(Key_Ctrl,Key_Left)) And
  337.        (Key=KeyCode(Key_Ctrl,Key_Left)) And
  338.        (VideoCard[Card].SX1>1) Then
  339.     Begin
  340.       ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength - SmoothX,
  341.                    (VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
  342.  
  343.       If Not KeyPressed Then
  344.       Begin
  345.  
  346.         ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength + SmoothX*5,
  347.                      (VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
  348.  
  349.         ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength + SmoothX*3,
  350.                      (VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
  351.  
  352.         ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength + SmoothX,
  353.                      (VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
  354.  
  355.       End;
  356.  
  357.       ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength,
  358.                    (VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
  359.     End;
  360.  
  361.     {Check for [Ctrl][PgDn - There is NO [Ctrl][Down] in Pascal}
  362.  
  363.     If (Special=SpecialCode(Key_Ctrl,Key_PgDn)) And
  364.        (Key=KeyCode(Key_Ctrl,Key_PgDn)) And
  365.        (VideoCard[Card].SY2<VideoCard[Card].YSize) Then
  366.     Begin
  367.       If Not KeyPressed Then
  368.       Begin
  369.  
  370.         ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength,
  371.                      (VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight + SmoothY);
  372.  
  373.         ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength,
  374.                      (VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight + SmoothY*3);
  375.  
  376.         ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength,
  377.                      (VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight + SmoothY*5);
  378.  
  379.         ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength,
  380.                      (VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight + SmoothY*7);
  381.       End;
  382.  
  383.       ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength,
  384.                    (VideoCard[Card].SY1) * VideoCard[Card].CharacterHeight);
  385.     End;
  386.  
  387.     {[Ctrl][PgUp]}
  388.  
  389.     If (Special=SpecialCode(Key_Ctrl,Key_PgUp)) And
  390.        (Key=KeyCode(Key_Ctrl,Key_PgUp)) And
  391.        (VideoCard[Card].SY1>1) Then
  392.     Begin
  393.       ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength,
  394.                    (VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight - SmoothY);
  395.  
  396.       If Not KeyPressed Then
  397.       Begin
  398.  
  399.         ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength,
  400.                      (VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight + SmoothY*5);
  401.  
  402.         ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength,
  403.                      (VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight + SmoothY*3);
  404.  
  405.         ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength,
  406.                      (VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight + SmoothY);
  407.  
  408.       End;
  409.  
  410.       ScreenOrigin((VideoCard[Card].SX1 - 1) * VideoCard[Card].CharacterLength,
  411.                    (VideoCard[Card].SY1 - 1) * VideoCard[Card].CharacterHeight);
  412.     End;
  413.  
  414.     If (Special=SpecialCode(Key_Ctrl, Key_F5)) And
  415.        (Key=KeyCode(Key_Ctrl, Key_F5)) Then
  416.     Begin
  417.  
  418.       {We have to delete buttons that we don't want moved if the
  419.        user drags the window - remember - some of the defined buttons
  420.        were not in the window - we must remove them.}
  421.  
  422.       For DelBut:=1 to 6 do
  423.       Begin
  424.         Win[ActiveWin].Buttons.GotoNumber(WinBut[ActiveWin][DelBut]);
  425.         Win[ActiveWin].Buttons.KillOne;
  426.       End;
  427.       If ActiveWin=2 Then       {This window has 7 Buttons}
  428.       Begin
  429.         Win[ActiveWin].Buttons.GotoNumber(WinBut[ActiveWin][DelBut]);
  430.         Win[ActiveWin].Buttons.KillOne;
  431.       End;
  432.  
  433.       Win[ActiveWin].Drag;
  434.  
  435.       {Now we can add the buttons back to the windows}
  436.  
  437.       Win[ActiveWin].Buttons.Add(2,2,2,2,False,#27);
  438.       WinBut[ActiveWin][1]:=Win[ActiveWin].Buttons.Number;
  439.       Win[ActiveWin].Buttons.Add(0,0,0,0,False,#9);
  440.       WinBut[ActiveWin][2]:=Win[ActiveWin].Buttons.Number;
  441.       Win[ActiveWin].Buttons.Add(0,0,0,0,SpecialCode(Key_Ctrl,Key_Right),KeyCode(Key_Ctrl,Key_Right));
  442.       WinBut[ActiveWin][3]:=Win[ActiveWin].Buttons.Number;
  443.       Win[ActiveWin].Buttons.Add(0,0,0,0,SpecialCode(Key_Ctrl,Key_Left) ,KeyCode(Key_Ctrl,Key_Left));
  444.       WinBut[ActiveWin][4]:=Win[ActiveWin].Buttons.Number;
  445.       Win[ActiveWin].Buttons.Add(0,0,0,0,SpecialCode(Key_Ctrl,Key_PgUp) ,KeyCode(Key_Ctrl,Key_PgUp));
  446.       WinBut[ActiveWin][5]:=Win[ActiveWin].Buttons.Number;
  447.       Win[ActiveWin].Buttons.Add(0,0,0,0,SpecialCode(Key_Ctrl,Key_PgDn) ,KeyCode(Key_Ctrl,Key_PgDn));
  448.       WinBut[ActiveWin][6]:=Win[ActiveWin].Buttons.Number;
  449.  
  450.       If ActiveWin=2 Then
  451.       Begin
  452.         Win[ActiveWin].Buttons.Add(0,0,0,0,False,'E');
  453.         WinBut[ActiveWin][7]:=Win[ActiveWin].Buttons.Number;
  454.       End;
  455.  
  456.     End;
  457.  
  458.     If (ActiveWin=2) And (Not Special) And (UpCase(Key)='E') Then
  459.     Begin
  460.       Mouse.Hide;
  461.       Win[ActiveWin].Lock;
  462.       VideoColor(14,7);
  463.       EditStr(15,4,20,False,TestGet);
  464.       Win[ActiveWin].UnLock;
  465.       Mouse.Show;
  466.     End;
  467.  
  468.     If ActiveWin=1 Then    {Window 1 has Slide Bars - Check for Them}
  469.     Begin
  470.  
  471.       If Held And (Special=SpecialCode(Mouse_Only, Mouse_SlideButtonVert)) And
  472.                   (Key=KeyCode(Mouse_Only, Mouse_SlideButtonVert)) Then Win[ActiveWin].DragVertSlideButton;
  473.  
  474.       If Held And (Special=SpecialCode(Mouse_Only, Mouse_SlideButtonHorz)) And
  475.                   (Key=KeyCode(Mouse_Only, Mouse_SlideButtonHorz)) Then Win[ActiveWin].DragHorzSlideButton;
  476.  
  477.       If (Special=SpecialCode(Mouse_Only, Mouse_SlideBarVert)) And
  478.          (Key=KeyCode(Mouse_Only, Mouse_SlideBarVert)) Then Win[ActiveWin].DragVertSlideButton;
  479.  
  480.       If (Special=SpecialCode(Mouse_Only, Mouse_SlideBarHorz)) And
  481.          (Key=KeyCode(Mouse_Only, Mouse_SlideBarHorz)) Then Win[ActiveWin].DragHorzSlideButton;
  482.  
  483.       If (Special=SpecialCode(Key_None, Key_Up)) And
  484.          (Key=KeyCode(Key_None, Key_Up)) And (Win[ActiveWin].VSlide.CurPos>0)
  485.       Then
  486.         Win[ActiveWin].UpdateVertSlideBar(Win[ActiveWin].VSlide.CurPos-1);
  487.  
  488.       If (Special=SpecialCode(Key_None, Key_Down)) And
  489.          (Key=KeyCode(Key_None, Key_Down)) And (Win[ActiveWin].VSlide.CurPos<99)
  490.       Then
  491.         Win[ActiveWin].UpdateVertSlideBar(Win[ActiveWin].VSlide.CurPos+1);
  492.  
  493.       If (Special=SpecialCode(Key_None, Key_Right)) And
  494.          (Key=KeyCode(Key_None, Key_Right)) And (Win[ActiveWin].HSlide.CurPos<99)
  495.       Then
  496.         Win[ActiveWin].UpdateHorzSlideBar(Win[ActiveWin].HSlide.CurPos+1);
  497.  
  498.       If (Special=SpecialCode(Key_None, Key_Left)) And
  499.          (Key=KeyCode(Key_None, Key_Left)) And (Win[ActiveWin].HSlide.CurPos>0)
  500.       Then
  501.         Win[ActiveWin].UpdateHorzSlideBar(Win[ActiveWin].HSlide.CurPos-1);
  502.  
  503.     End;
  504.  
  505.     If ActiveWin=1 Then
  506.     Begin
  507.       Mouse.Hide;                      {Hide mouse - we want to write to screen}
  508.       Win[1].Lock;
  509.       VideoColor(Blue,Green);
  510.       GotoXY(5,5);                     {Relative}
  511.       Str(Win[1].VSlide.CurPos+1,St);
  512.       WriteStr('Line  : '+St+'  ');    {Update window information}
  513.       GotoXY(5,7);
  514.       Str(Win[1].HSlide.CurPos+1,St);
  515.       WriteStr('Column: '+St+'  ');
  516.       Win[1].UnLock;
  517.       Mouse.Show;                      {Show mouse again}
  518.     End;
  519.  
  520.   Until ((MX=2) And (MY=2)) Or (Key=#27);    {Exit Command}
  521.   PopCursorSize;                             {Restore Cursor Size}
  522.                                              {To be polite, you should here
  523.                                               call SetVitualSceen, ScreenOrigin and
  524.                                               ClrScr}
  525. End.
  526.