home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / TJOCKREF.ZIP / KEYTTT.TXT < prev    next >
Encoding:
Text File  |  1988-08-26  |  9.5 KB  |  379 lines

  1. !SHORT:Confine_Mouse_Horiz     Resrtrict position of mouse cursor horizontally
  2. Confine_Mouse_Horiz                                             KeyTTT
  3.           
  4.  
  5.  
  6. Purpose   To restrict the screen position of the mouse cursor
  7.           horizontally.
  8.  
  9. Declaration    Confine_Mouse_Horiz(Left,Right: integer);
  10.                     
  11.            Left is the left most X coord (1..80)
  12.            Right is the right most X coord (1..80)
  13.  
  14. Uses CRT, DOS, KeyTTT.
  15.  
  16. Remarks   If the mouse is outside the confined coords when the
  17.           restrictions are made, the mouse is repositioned inside the
  18.           nearest boundary, as soon as any mouse activity occurs .
  19.  
  20.  
  21.  
  22. Example
  23.  
  24.  
  25.                USES CRT, DOS, KEYTTT;
  26.                BEGIN
  27.                  HIDE_MOUSE_CURSOR;
  28.                  CONFINE_MOUSE_HORIZ(20,60);
  29.                  SHOW_MOUSE_CURSOR;
  30.                END.
  31.           
  32.  
  33. The mouse is resticted to movement between columns 20 and 60.
  34.  
  35. !SEEALSO:Confine_Mouse_Vert
  36.                            
  37.  
  38. !SHORT:Confine_Mouse_Vert      Restrict position of mouse cursor vertically
  39. Confine_Mouse_Vert                                              KeyTTT
  40.      
  41.  
  42.  
  43. Purpose   To restrict the screen position of the mouse cursor
  44.           vertically.
  45.  
  46. Declaration    Confine_Mouse_Vert(Top,Bot: integer);
  47.                
  48.           Top is the upper most Y coord (1..25)
  49.           Bot is the lower most Y coord (1..25)
  50.  
  51. Uses CRT, DOS, KeyTTT;
  52.  
  53. Remarks   If the mouse is outside the confined coords, then as soon as
  54.           any mouse activity occurs (or a mouse function is called)
  55.           the mouse is repositioned inside the nearest boundary.
  56.  
  57.  
  58.  
  59. Example
  60.  
  61.  
  62.                USES CRT, DOS, KEYTTT;
  63.                BEGIN
  64.                  HIDE_MOUSE_CURSOR;
  65.                  CONFINE_MOUSE_HORIZ(20,60);
  66.                  CONFINE_MOUSE_VERT(5,15);
  67.                  SHOW_MOUSE_CURSOR;
  68.                END.
  69.      
  70.  
  71. The mouse is resticted to movement between columns 20 to 60, and
  72. between rows 5 to 15.
  73.  
  74.  
  75. !SEEALSO:Confine_Mouse_Horiz
  76.  
  77.  
  78. !SHORT:DelayKey                Pause specified time period or key press
  79. DelayKey                                                        KeyTTT
  80.           
  81.  
  82.  
  83. Purpose   To pause while user presses key or a specified time period
  84.           elapses.
  85.  
  86. Declaration    DelayKey(Time: integer);
  87.                     
  88.           Time is the maximum pause in seconds.
  89.  
  90. Uses CRT, DOS, KeyTTT.
  91.  
  92. Remarks   This is one of my favorites. The system pauses until a key
  93.           is pressed or, if a key isn't pressed, until a specified
  94.           time has elapsed.
  95.                     
  96.           Very useful for temporarily displaying messages, copyright
  97.           screens etc. As soon as the user presses a key (or there is
  98.           mouse activity) the procedure ends.
  99.  
  100.  
  101.  
  102. Example
  103.  
  104.  
  105.                USES CRT, DOS, KEYTTT;
  106.                BEGIN
  107.                  DISPLAY_HELP;      {SOME EARLIER DEFINED PROCEDURE}
  108.                  DELAYKEY(5);
  109.                  CLRSCR;
  110.                END.
  111.           
  112.  
  113. A help screen is displayed for up to 5 seconds or until a key is
  114. pressed.
  115.  
  116. !SEEALSO:GetKey
  117.                
  118.  
  119. !SHORT:GetKey                  Read a character from keyboard
  120. GetKey                                                          KeyTTT
  121.      
  122.  
  123.  
  124. Purpose   To read a character from the keyboard.
  125.  
  126. Declaration    GetKey:char;
  127.  
  128. Returns   Char
  129.  
  130. Uses CRT, DOS, KeyTTT.
  131.  
  132. Remarks   This is the main function in the KeyTTT unit and is called
  133.           throughout the Toolkit.
  134.                
  135.           This is a fully functional replacement for Turbo's internal
  136.           ReadKey command. Refer to Appendix B for a full list of all
  137.           the character codes that are returned.
  138.  
  139.  
  140.  
  141. Example
  142.  
  143.  
  144.                USES CRT, FASTTTT, DOS, KEYTTT;
  145.                VAR CH : CHAR;
  146.                BEGIN
  147.                  WRITECENTER(25,LIGHTCYAN,BLUE,'PRESS F10 TO CONTINUE');
  148.                  CH := GETKEY;
  149.                  IF CH <> #196 THEN
  150.                     HALT;
  151.                END.
  152.      
  153.  
  154. The code for F10 is #196, see appendix B.
  155.  
  156. !SEEALSO:DelayKey
  157.  
  158.  
  159. !SHORT:Get_Mouse_Action        Determine mouse activity
  160. Get_Mouse_Action                                                KeyTTT
  161.           
  162.  
  163.  
  164. Purpose   Determine mouse activity i.e. movement and button presses.
  165.  
  166. Declaration    Get_Mouse_Action(var But:button; var Hor, Ver:
  167.                integer);
  168.                     
  169.           But is retuned with one of NoB, LeftB, RightB, BothB
  170.           Hor and Ver return the horizontal and vertical movement
  171.  
  172. Uses CRT, DOS, KeyTTT.
  173.  
  174. Remarks   This procedure is designed for internal use and is called by
  175.           GetKey.
  176.                     
  177.           The Hor & Ver variables return the movement in cols and rows
  178.           not pixels i.e. Pixel div 8. The movement is returned
  179.           relative to the position of the mouse the last time the
  180.           procedure was called.
  181.  
  182. Example
  183.  
  184.  
  185.                USES CRT, DOS, KEYTTT;
  186.                VAR
  187.                B : BUTTON;
  188.                X,Y : INTEGER;
  189.                BEGIN
  190.                  REPEAT
  191.                    GET_MOUSE_ACTION(B,X,Y);
  192.                  UNTIL B = LEFTB;
  193.                END.
  194.                     
  195.           
  196.  
  197. This program continues looping until the left mouse button is pressed.
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205. !SHORT:Hide_Mouse_Cursor       Hide mouse cursor from view
  206. Hide_Mouse_Cursor                                KeyTTT
  207.      
  208.  
  209.  
  210. Purpose   To hide the mouse cursor from view!
  211.  
  212. Declaration    Hide_Mouse_Cursor;
  213.  
  214. Uses CRT, DOS, KeyTTT.
  215.  
  216. Remarks   The mouse cursor is set on with the Show_Mouse_Cursor
  217.           procedure.
  218.                
  219.           The normal text Cursor is not affected by this procedure,
  220.           and the OffCursor procedure should also be called to turn it
  221.           off.
  222.  
  223.  
  224.  
  225. Example
  226.  
  227.  
  228.                USES CRT, DOS, KEYTTT;
  229.                BEGIN
  230.                  HIDE_MOUSE_CURSOR;
  231.                END.
  232.      
  233.  
  234. See the file MouseDem.pas on the distribution disk for a more detailed
  235. example.
  236.  
  237. !SEEALSO:Show_Mouse_Cursor
  238.  
  239.  
  240. !SHORT:Mouse_Installed         Indicate it a mouse is installed
  241. Mouse_Installed                                                 KeyTTT
  242.           
  243.  
  244.  
  245. Purpose   To indicate if a Microsoft compatible mouse is installed.
  246.  
  247. Declaration    Mouse_Installed:boolean;
  248.  
  249. Returns   Boolean;
  250.  
  251. Uses CRT, DOS, KeyTTT.
  252.  
  253. Remarks   This procedure is automatically called (if you include the
  254.           KeyTTT unit in your program) and it updates the global
  255.           variable Moused.
  256.  
  257. Example
  258.  
  259.  
  260.                USES CRT, DOS, KEYTTT;
  261.                BEGIN
  262.                  IF NOT MOUSE_INSTALLED THEN HALT;
  263.                END.
  264.           
  265.  
  266. See the file MouseDem.pas on the distribution disk for a more detailed
  267. example.
  268.  
  269.           
  270.  
  271.  
  272.  
  273.  
  274. !SHORT:Move_Mouse              Reposition mouse cursor
  275. Move_Mouse                                                      KeyTTT
  276.      
  277.  
  278.  
  279. Purpose   To reposition the mouse cursor.
  280.  
  281. Declaration    Move_Mouse(Hor,Ver:integer);
  282.                
  283.           Hor is the X coordinate (1..80)
  284.           Ver is the Y coordinate (1..25)
  285.  
  286. Uses CRT, DOS, KeyTTT.
  287.  
  288. Remarks   This procedure is the functional equivalent of GotoXY for
  289.           the text cursor.
  290.  
  291.  
  292.  
  293. Example
  294.  
  295.  
  296.                USES CRT, DOS, KEYTTT;
  297.                BEGIN
  298.                  MOVE_MOUSE(40,13);
  299.                END.
  300.      
  301.  
  302. The mouse cursor is moved to the center of the display. See the file
  303. MouseDem.pas on the distribution disk for a more detailed example.
  304.  
  305. !SEEALSO:Confine_Mouse_Horiz Confine_Mouse_Vert
  306.  
  307.  
  308. !SHORT:Set_Mouse_Cursor_style  Change appearance of the mouse cursor
  309. Set_Mouse_Cursor_Style                                          KeyTTT
  310.           
  311.  
  312.  
  313. Purpose   To change the appearance of the mouse cursor.
  314.  
  315. Declaration    Set_Mouse_Cursor_Style(OrdChar:integer);
  316.                     
  317.           OrdChar is the ASCII code for the desired cursor character.
  318.  
  319. Uses CRT, DOS, KeyTTT.
  320.  
  321. Remarks   In text mode the shape of the mouse cursor can be any of the
  322.           displayable ASCII characters - you can even make the cursor
  323.           the letter 'C' if you feel so inclined!
  324.                     
  325.            The default cursor is a small rectangle. Once the cursor
  326.            style has been modified, it will assume the new style until
  327.            the mouse is re-installed (usually from a reboot), or until
  328.            this procedure changes it again.
  329.                     
  330.            Refer to page 568 of the Turbo Pascal Owner's Handbook for a
  331.            list of the ASCII characters and codes.
  332.  
  333.  
  334.  
  335. Example
  336.  
  337.  
  338.                USES CRT, DOS, KEYTTT;
  339.                BEGIN
  340.                  SET_MOUSE_CURSOR_STYLE(29);
  341.                END.
  342.           
  343.  
  344. The cursor is changed to a double headed arrow.
  345.  
  346. !SEEALSO:Show_Mouse_Cursor
  347.  
  348.  
  349. !SHORT:Show_Mouse_Cursor       Redisplay mouse cursor
  350. Show_Mouse_Cursor                                               KeyTTT
  351.      
  352.  
  353.  
  354. Purpose   To redisplay the mouse cursor.
  355.  
  356. Declaration    Show_Mouse_Cursor;
  357.  
  358. Uses CRT, DOS, KeyTTT.
  359.  
  360. Remarks   The mouse cursor is not normally displayed. Use this
  361.           procedure to display the mouse and use Hide_Mouse_Cursor to
  362.           turn it off again.
  363.  
  364.  
  365.  
  366. Example
  367.  
  368.  
  369.                USES CRT, DOS, KEYTTT;
  370.                BEGIN
  371.                  SHOW_MOUSE_CURSOR;
  372.                END.
  373.      
  374.  
  375. See the file MouseDem.pas on the distribution disk for a more detailed
  376. example.
  377.  
  378. !SEEALSO:Show_Mouse_Cursor Confine_Mouse_Horiz Confine_Mouse_Vert
  379.