home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / TOOLKIT.ZIP / CURSRTTT.DEM next >
Encoding:
Text File  |  1986-09-28  |  3.1 KB  |  120 lines

  1. Program Examples_of_Cursor_Control;
  2.  
  3. {$I Decl.TTT}
  4. {$I Fastwrit.TTT}
  5.  
  6. Procedure Set_Up_Screen;
  7. begin
  8. Clrscr;
  9. Box(20,1,60,5,white,blue,2);
  10. ClearText(21,2,59,4,white,blue);
  11. WriteBetween(20,60,3,white,blue,'Technojocks Turbo Toolkit');
  12. WriteAT(75,1,yellow,black,'V3.0');
  13. WriteCenter(10,lightgreen,black,'Examples of the Toolkits Cursor Control Features');
  14. WriteCenter(15,yellow,black,'Press the cursor keys to move the cursor, and press');
  15. WriteCenter(16,yellow,black,'the + and - keys to change the shape of the cursor.');
  16. WriteCenter(17,yellow,black,'          Press End or Esc to finish.              ');
  17. WriteAT(1,21,cyan,black,'    X Coordinate : ');
  18. WriteAT(1,22,cyan,black,'    Y Coordinate : ');
  19. WriteAT(1,23,cyan,black,'   Top scan code : ');
  20. WriteAT(1,24,cyan,black,'Bottom scan code : ');
  21. end;
  22.  
  23. procedure Wait_for_keypress(var Character:char);
  24. begin
  25.  Funckey := false;
  26.  read(kbd,Character);
  27.  if (Character = #27) and keypressed then
  28.  begin
  29.   read(kbd,Character);
  30.   Funckey := true;
  31.  end;
  32. end;
  33.  
  34. Function Int_to_Str(Number:Integer):string20;
  35. var Temp : string20;
  36. begin
  37.  Str(Number,temp);
  38.  Int_to_Str := temp;
  39. end;
  40.  
  41. Procedure Cursor_Control;
  42. const
  43. LocX : integer = 40;
  44. LocY : integer = 19;
  45. Top  : integer = 0;
  46. HidTop = 14;
  47. var
  48. Bot : integer;
  49. Finished : boolean;
  50. begin
  51. Finished := false;
  52. If CRTmode = 7 then
  53.  Bot := 13
  54. else
  55.  Bot := 7;
  56. Repeat
  57.   PosCursor(LocX,LocY);
  58.   SizeCursor(Top,Bot);
  59.   WriteAT(20,21,white,black,Int_to_str(LocX)+'  ');
  60.   WriteAT(20,22,white,black,Int_to_Str(LocY)+'  ');
  61.   WriteAT(20,23,white,black,Int_To_Str(Top)+'  ');
  62.   WriteAT(20,24,white,black,Int_to_Str(Bot)+'  ');
  63.   If Top = HidTop then
  64.    WriteAT(1,25,white,black,'Hidden Cursor')
  65.   else
  66.    WriteAT(1,25,white,black,'             ');
  67.   Wait_for_Keypress(Ch);
  68.   If Ch in [Esckey,MinusKey,PlusKey] then Funckey := true;
  69.   If Funckey = true then
  70.   begin
  71.    Case Ch of
  72.    EscKey,
  73.    EndKey        :  Finished := true;
  74.    PlusKey       : If Top = Hidtop then Top := 7
  75.                    else
  76.                     If Top > 0 then
  77.                       Top := Top - 1
  78.                      else
  79.                       Top := HidTop;
  80.    MinusKey      : If Top = HidTop then Top := 0
  81.                    else
  82.                     If Top < Bot then
  83.                      Top := Top + 1
  84.                     else
  85.                      Top := HidTop;
  86.    CursorLeft    : If LocX > 1 then
  87.                     LocX := LocX - 1
  88.                    else
  89.                     LocX := 80;
  90.    CursorRight   : If LocX < 80 then
  91.                     LocX := LocX +1
  92.                    else
  93.                     LocX := 1;
  94.    CursorUP      : If LocY > 1 then
  95.                     LocY := LocY - 1
  96.                    else
  97.                     LocY := 25;
  98.    CursorDown    : If LocY < 25 then
  99.                     LocY := LocY + 1
  100.                    else
  101.                     LocY := 1;
  102.   end;   {case}
  103.  end;    {if funckey}
  104. Until Finished;
  105. end; {proc Cursor_Control}
  106.  
  107.  
  108. Procedure Wrap_Up;
  109. begin
  110. Clrscr;
  111. Writeln('Run DemoTTT.com for the main demo program');
  112. Write('Technojocks Turbo ToolBox');
  113. Oncursor;
  114. end;
  115.  
  116. begin
  117. Set_Up_Screen;
  118. Cursor_Control;
  119. Wrap_Up;
  120. end.