home *** CD-ROM | disk | FTP | other *** search
/ Point Programming 1 / PPROG1.ISO / c / sclib31 / examples / cursor.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-31  |  1.3 KB  |  52 lines

  1. #include <scl1.h>
  2. #include <scl1keys.h>
  3.  
  4. /**********************************************
  5.     Shows the use of cursor related functions */
  6.  
  7. char Text[]="\n\nCursor size and position has been be saved using PushCursor.\n\n"
  8.             "\t<*> Move the cursor around your screen using the arrow keys\n"
  9.             "\t<*> Change cursor size using the TAB key\n"
  10.             "\t<*> Press ESC to restore original size and position\n";
  11.  
  12. main()
  13. {
  14. unsigned int Key;
  15. int CurFlag=0;
  16.  
  17. printf(Text);
  18.  
  19. PushCursor();   /* save cursor size and position */
  20.  
  21.     /* let user modify size and position */
  22.  
  23. do
  24.     {
  25.     switch((Key=GetKey()))
  26.         {
  27.         case UP:
  28.             SetCurPos(GetCurLine()-1,GetCurCol());
  29.             break;
  30.         case DOWN:
  31.             SetCurPos(GetCurLine()+1,GetCurCol());
  32.             break;
  33.         case LEFT:
  34.             SetCurPos(GetCurLine(),GetCurCol()-1);
  35.             break;
  36.         case RIGHT:
  37.             SetCurPos(GetCurLine(),GetCurCol()+1);
  38.             break;
  39.         case TAB:
  40.             CurFlag ^= 1;
  41.             if(CurFlag)
  42.                 BigCursor();
  43.             else
  44.                 CursorOn();
  45.             break;
  46.         }
  47.     }while(Key != ESC);
  48.  
  49.     /* restore original size and position */
  50.  
  51. PopCursor();
  52. }