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

  1. #include <scl1.h>
  2. #include <scl1clor.h>
  3.  
  4.     /* TextWindow example */
  5.  
  6. char *strings[]={
  7.    "These strings will be written",
  8.    "to a Text Window, one by one.",
  9.    "Text will scroll in TTY mode",
  10.    "So as to simulate a",
  11.    "DOS like screen.",
  12.    "Several control characters",
  13.    "like\t\ttab (\\t),",
  14.    "new line (\\n)\rand carriage return (\\r)",
  15.    "are supported."};
  16.  
  17. main()
  18. {
  19. TWData twd;
  20. int i,Mess;
  21.  
  22. Cls(WHITE_BLACK,CLS_ALL);
  23. TextWindow(TW_INIT,&twd);     /* initialize structure */
  24. twd.UpperRow=10;              /* modify position */
  25. twd.LowerRow=15;
  26. twd.LeftCol=20;
  27. twd.RightCol=60;
  28.  
  29.      /* in this example we'll check for the WINDOW_FULL message and
  30.      wait for a key to be pressed before writing anything else */
  31.  
  32. TextWindow(TW_DRAW,&twd);     /* draw */
  33. for(i=0;i < 9;++i)
  34.      {
  35.      Mess=TextWindow(TW_WRITE,&twd,strings[i]);
  36.      if(Mess==TW_WINDOW_FULL) /* window full? */
  37.           {
  38.           WriteScreen(WHITE_BLACK+HIGHLIGHT,16,21,"Press any key for more...");
  39.           GetKey();
  40.           TextWindow(TW_CLS,&twd);
  41.           }
  42.      }
  43.  
  44. WaitTime(100);
  45.  
  46.  /* now, we'll get the same effect using the WAIT_ON message, TextWindow
  47.     will now stop and wait for a key when the  window is full */
  48.  
  49. TextWindow(TW_DRAW,&twd);
  50. TextWindow(TW_WAIT_ON,&twd);
  51. for(i=0;i < 9;++i)
  52.      TextWindow(TW_WRITE,&twd,strings[i]);
  53. }
  54.