home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / t / tcu_32.zip / TCU_32.ZIP / WINDOWS.C < prev    next >
C/C++ Source or Header  |  1991-03-26  |  2KB  |  74 lines

  1. #include <stdlib.h>
  2. #include <string.h>
  3. #include <conio.h>
  4. #include <usr\tcu.h>
  5.  
  6. void main (void)
  7. {
  8.    TCU_WINDOW  my_window1,
  9.                my_window2;
  10.    int         i,
  11.                length;
  12.    char        input_buffer[6];
  13.  
  14.    tcu_open_window (&my_window1,
  15.                     5, 3,
  16.                     30, 15,
  17.                     "Window I",
  18.                     tcu_colour_attrib (YELLOW, BLUE),
  19.                     tcu_colour_attrib (WHITE, BLUE),
  20.                     tcu_colour_attrib (CYAN, BLUE),
  21.                     TCU_BOX_DOUBLE);
  22.  
  23.    tcu_open_window (&my_window2,
  24.                     42, 2,
  25.                     25, 20,
  26.                     NULL,
  27.                     tcu_colour_attrib (BLUE, LIGHTGRAY),
  28.                     tcu_colour_attrib (LIGHTGREEN, LIGHTGRAY),
  29.                     tcu_colour_attrib (LIGHTCYAN, LIGHTGRAY),
  30.                     TCU_BOX_DOUBLE);
  31.  
  32.    tcu_wprintf (&my_window1, "       Control Window\n\n");
  33.  
  34.    do {
  35.  
  36.       tcu_wprintf (&my_window1, "Lines to display? ");
  37.       strcpy (input_buffer, "10");
  38.       tcu_wgets (&my_window1, 5, input_buffer, &length);
  39.       tcu_wprintf (&my_window1, "\n");
  40.  
  41.       if (length == -1)
  42.          if (tcu_get_confirm (20, 20, tcu_colour_attrib (RED, WHITE),
  43.                               tcu_colour_attrib (BLACK, WHITE),
  44.                               "Are you sure you want to quit?")) {
  45.             tcu_wprintf (&my_window1, "\nOooh! You pressed ESCape on me!");
  46.             break;
  47.          }
  48.  
  49.       for (i=1; i<=atoi(input_buffer); i++)
  50.          tcu_wprintf (&my_window2, "Window 2, Line #%d\n", i);
  51.       tcu_change_colour (&my_window2,
  52.                          tcu_colour_attrib (LIGHTGREEN+BLINK, LIGHTGRAY));
  53.       tcu_wprintf (&my_window2, "---End of display---\n");
  54.       tcu_change_colour (&my_window2,
  55.                          tcu_colour_attrib (LIGHTGREEN, LIGHTGRAY));
  56.  
  57.    } while (atoi(input_buffer));
  58.  
  59.    tcu_wprintf (&my_window1, "\n\nPress return to clear the\nwindows");
  60.  
  61.    while (!kbhit());
  62.    getch();
  63.  
  64.    tcu_close_window (&my_window1);
  65.  
  66.    while (!kbhit());
  67.    getch();
  68.  
  69.    tcu_close_window (&my_window2);
  70.  
  71.    while (!kbhit());
  72.    getch();
  73. }
  74.