home *** CD-ROM | disk | FTP | other *** search
- Program Examples_of_Cursor_Control;
-
- {$I Decl.TTT}
- {$I Fastwrit.TTT}
-
- Procedure Set_Up_Screen;
- begin
- Clrscr;
- Box(20,1,60,5,white,blue,2);
- ClearText(21,2,59,4,white,blue);
- WriteBetween(20,60,3,white,blue,'Technojocks Turbo Toolkit');
- WriteAT(75,1,yellow,black,'V3.0');
- WriteCenter(10,lightgreen,black,'Examples of the Toolkits Cursor Control Features');
- WriteCenter(15,yellow,black,'Press the cursor keys to move the cursor, and press');
- WriteCenter(16,yellow,black,'the + and - keys to change the shape of the cursor.');
- WriteCenter(17,yellow,black,' Press End or Esc to finish. ');
- WriteAT(1,21,cyan,black,' X Coordinate : ');
- WriteAT(1,22,cyan,black,' Y Coordinate : ');
- WriteAT(1,23,cyan,black,' Top scan code : ');
- WriteAT(1,24,cyan,black,'Bottom scan code : ');
- end;
-
- procedure Wait_for_keypress(var Character:char);
- begin
- Funckey := false;
- read(kbd,Character);
- if (Character = #27) and keypressed then
- begin
- read(kbd,Character);
- Funckey := true;
- end;
- end;
-
- Function Int_to_Str(Number:Integer):string20;
- var Temp : string20;
- begin
- Str(Number,temp);
- Int_to_Str := temp;
- end;
-
- Procedure Cursor_Control;
- const
- LocX : integer = 40;
- LocY : integer = 19;
- Top : integer = 0;
- HidTop = 14;
- var
- Bot : integer;
- Finished : boolean;
- begin
- Finished := false;
- If CRTmode = 7 then
- Bot := 13
- else
- Bot := 7;
- Repeat
- PosCursor(LocX,LocY);
- SizeCursor(Top,Bot);
- WriteAT(20,21,white,black,Int_to_str(LocX)+' ');
- WriteAT(20,22,white,black,Int_to_Str(LocY)+' ');
- WriteAT(20,23,white,black,Int_To_Str(Top)+' ');
- WriteAT(20,24,white,black,Int_to_Str(Bot)+' ');
- If Top = HidTop then
- WriteAT(1,25,white,black,'Hidden Cursor')
- else
- WriteAT(1,25,white,black,' ');
- Wait_for_Keypress(Ch);
- If Ch in [Esckey,MinusKey,PlusKey] then Funckey := true;
- If Funckey = true then
- begin
- Case Ch of
- EscKey,
- EndKey : Finished := true;
- PlusKey : If Top = Hidtop then Top := 7
- else
- If Top > 0 then
- Top := Top - 1
- else
- Top := HidTop;
- MinusKey : If Top = HidTop then Top := 0
- else
- If Top < Bot then
- Top := Top + 1
- else
- Top := HidTop;
- CursorLeft : If LocX > 1 then
- LocX := LocX - 1
- else
- LocX := 80;
- CursorRight : If LocX < 80 then
- LocX := LocX +1
- else
- LocX := 1;
- CursorUP : If LocY > 1 then
- LocY := LocY - 1
- else
- LocY := 25;
- CursorDown : If LocY < 25 then
- LocY := LocY + 1
- else
- LocY := 1;
- end; {case}
- end; {if funckey}
- Until Finished;
- end; {proc Cursor_Control}
-
-
- Procedure Wrap_Up;
- begin
- Clrscr;
- Writeln('Run DemoTTT.com for the main demo program');
- Write('Technojocks Turbo ToolBox');
- Oncursor;
- end;
-
- begin
- Set_Up_Screen;
- Cursor_Control;
- Wrap_Up;
- end.