!SHORT:Confine_Mouse_Horiz Resrtrict position of mouse cursor horizontally Confine_Mouse_Horiz KeyTTT Purpose To restrict the screen position of the mouse cursor horizontally. Declaration Confine_Mouse_Horiz(Left,Right: integer); Left is the left most X coord (1..80) Right is the right most X coord (1..80) Uses CRT, DOS, KeyTTT. Remarks If the mouse is outside the confined coords when the restrictions are made, the mouse is repositioned inside the nearest boundary, as soon as any mouse activity occurs . Example USES CRT, DOS, KEYTTT; BEGIN HIDE_MOUSE_CURSOR; CONFINE_MOUSE_HORIZ(20,60); SHOW_MOUSE_CURSOR; END. The mouse is resticted to movement between columns 20 and 60. !SEEALSO:Confine_Mouse_Vert !SHORT:Confine_Mouse_Vert Restrict position of mouse cursor vertically Confine_Mouse_Vert KeyTTT Purpose To restrict the screen position of the mouse cursor vertically. Declaration Confine_Mouse_Vert(Top,Bot: integer); Top is the upper most Y coord (1..25) Bot is the lower most Y coord (1..25) Uses CRT, DOS, KeyTTT; Remarks If the mouse is outside the confined coords, then as soon as any mouse activity occurs (or a mouse function is called) the mouse is repositioned inside the nearest boundary. Example USES CRT, DOS, KEYTTT; BEGIN HIDE_MOUSE_CURSOR; CONFINE_MOUSE_HORIZ(20,60); CONFINE_MOUSE_VERT(5,15); SHOW_MOUSE_CURSOR; END. The mouse is resticted to movement between columns 20 to 60, and between rows 5 to 15. !SEEALSO:Confine_Mouse_Horiz !SHORT:DelayKey Pause specified time period or key press DelayKey KeyTTT Purpose To pause while user presses key or a specified time period elapses. Declaration DelayKey(Time: integer); Time is the maximum pause in seconds. Uses CRT, DOS, KeyTTT. Remarks This is one of my favorites. The system pauses until a key is pressed or, if a key isn't pressed, until a specified time has elapsed. Very useful for temporarily displaying messages, copyright screens etc. As soon as the user presses a key (or there is mouse activity) the procedure ends. Example USES CRT, DOS, KEYTTT; BEGIN DISPLAY_HELP; {SOME EARLIER DEFINED PROCEDURE} DELAYKEY(5); CLRSCR; END. A help screen is displayed for up to 5 seconds or until a key is pressed. !SEEALSO:GetKey !SHORT:GetKey Read a character from keyboard GetKey KeyTTT Purpose To read a character from the keyboard. Declaration GetKey:char; Returns Char Uses CRT, DOS, KeyTTT. Remarks This is the main function in the KeyTTT unit and is called throughout the Toolkit. This is a fully functional replacement for Turbo's internal ReadKey command. Refer to Appendix B for a full list of all the character codes that are returned. Example USES CRT, FASTTTT, DOS, KEYTTT; VAR CH : CHAR; BEGIN WRITECENTER(25,LIGHTCYAN,BLUE,'PRESS F10 TO CONTINUE'); CH := GETKEY; IF CH <> #196 THEN HALT; END. The code for F10 is #196, see appendix B. !SEEALSO:DelayKey !SHORT:Get_Mouse_Action Determine mouse activity Get_Mouse_Action KeyTTT Purpose Determine mouse activity i.e. movement and button presses. Declaration Get_Mouse_Action(var But:button; var Hor, Ver: integer); But is retuned with one of NoB, LeftB, RightB, BothB Hor and Ver return the horizontal and vertical movement Uses CRT, DOS, KeyTTT. Remarks This procedure is designed for internal use and is called by GetKey. The Hor & Ver variables return the movement in cols and rows not pixels i.e. Pixel div 8. The movement is returned relative to the position of the mouse the last time the procedure was called. Example USES CRT, DOS, KEYTTT; VAR B : BUTTON; X,Y : INTEGER; BEGIN REPEAT GET_MOUSE_ACTION(B,X,Y); UNTIL B = LEFTB; END. This program continues looping until the left mouse button is pressed. !SHORT:Hide_Mouse_Cursor Hide mouse cursor from view Hide_Mouse_Cursor KeyTTT Purpose To hide the mouse cursor from view! Declaration Hide_Mouse_Cursor; Uses CRT, DOS, KeyTTT. Remarks The mouse cursor is set on with the Show_Mouse_Cursor procedure. The normal text Cursor is not affected by this procedure, and the OffCursor procedure should also be called to turn it off. Example USES CRT, DOS, KEYTTT; BEGIN HIDE_MOUSE_CURSOR; END. See the file MouseDem.pas on the distribution disk for a more detailed example. !SEEALSO:Show_Mouse_Cursor !SHORT:Mouse_Installed Indicate it a mouse is installed Mouse_Installed KeyTTT Purpose To indicate if a Microsoft compatible mouse is installed. Declaration Mouse_Installed:boolean; Returns Boolean; Uses CRT, DOS, KeyTTT. Remarks This procedure is automatically called (if you include the KeyTTT unit in your program) and it updates the global variable Moused. Example USES CRT, DOS, KEYTTT; BEGIN IF NOT MOUSE_INSTALLED THEN HALT; END. See the file MouseDem.pas on the distribution disk for a more detailed example. !SHORT:Move_Mouse Reposition mouse cursor Move_Mouse KeyTTT Purpose To reposition the mouse cursor. Declaration Move_Mouse(Hor,Ver:integer); Hor is the X coordinate (1..80) Ver is the Y coordinate (1..25) Uses CRT, DOS, KeyTTT. Remarks This procedure is the functional equivalent of GotoXY for the text cursor. Example USES CRT, DOS, KEYTTT; BEGIN MOVE_MOUSE(40,13); END. The mouse cursor is moved to the center of the display. See the file MouseDem.pas on the distribution disk for a more detailed example. !SEEALSO:Confine_Mouse_Horiz Confine_Mouse_Vert !SHORT:Set_Mouse_Cursor_style Change appearance of the mouse cursor Set_Mouse_Cursor_Style KeyTTT Purpose To change the appearance of the mouse cursor. Declaration Set_Mouse_Cursor_Style(OrdChar:integer); OrdChar is the ASCII code for the desired cursor character. Uses CRT, DOS, KeyTTT. Remarks In text mode the shape of the mouse cursor can be any of the displayable ASCII characters - you can even make the cursor the letter 'C' if you feel so inclined! The default cursor is a small rectangle. Once the cursor style has been modified, it will assume the new style until the mouse is re-installed (usually from a reboot), or until this procedure changes it again. Refer to page 568 of the Turbo Pascal Owner's Handbook for a list of the ASCII characters and codes. Example USES CRT, DOS, KEYTTT; BEGIN SET_MOUSE_CURSOR_STYLE(29); END. The cursor is changed to a double headed arrow. !SEEALSO:Show_Mouse_Cursor !SHORT:Show_Mouse_Cursor Redisplay mouse cursor Show_Mouse_Cursor KeyTTT Purpose To redisplay the mouse cursor. Declaration Show_Mouse_Cursor; Uses CRT, DOS, KeyTTT. Remarks The mouse cursor is not normally displayed. Use this procedure to display the mouse and use Hide_Mouse_Cursor to turn it off again. Example USES CRT, DOS, KEYTTT; BEGIN SHOW_MOUSE_CURSOR; END. See the file MouseDem.pas on the distribution disk for a more detailed example. !SEEALSO:Show_Mouse_Cursor Confine_Mouse_Horiz Confine_Mouse_Vert