home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 15 / CD_ASCQ_15_070894.iso / maj / 680 / examples / kbdedit.c < prev    next >
C/C++ Source or Header  |  1994-03-14  |  792b  |  47 lines

  1. /*
  2. ** KBDEDIT.C: Lets the user edit a string using kbdedit.
  3. */
  4.  
  5. #include <stdio.h>
  6. #include <pictor.h>
  7.  
  8. COLORSTRUCT colors = {
  9.    foreback(BLACK,WHITE),
  10.    0x00,  /* not used by kbdedit() */
  11.    foreback(WHITE,BLACK),
  12.    0x00   /* not used by kbdedit() */
  13. };
  14.  
  15. char buffer[128];
  16.  
  17. void main()
  18. {
  19.    int i;
  20.  
  21.    /* initialize library */
  22.    initvideo();
  23.  
  24.    /* clear screen */
  25.    vcolor(foreback(BOLD+WHITE,BLUE));
  26.    cls();
  27.  
  28.    setvpos(3,5);
  29.    vputs("KbdEdit: [");
  30.    setvpos(3,15 + 25);
  31.    vputc(']');
  32.  
  33.    i = kbdedit(buffer,3,15,25,127,&colors);
  34.  
  35.    /* restore screen */
  36.    vcolor(foreback(WHITE,BLACK));
  37.    cls();
  38.  
  39.    /* print result */
  40.    if(i == TRUE)
  41.       printf("You entered: %s\n",buffer);
  42.    else
  43.       printf("You pressed <Escape>\n");
  44.  
  45. }
  46.  
  47.