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

  1. #include <scl1.h>
  2. #include <scl1keys.h>
  3. #include <scl1clor.h>
  4.  
  5.  /*************************************************************
  6.    Shows the use of LineEditor function. See file LINEDIT2.C
  7.    for another example of LineEditor */
  8.  
  9. unsigned int ExitKeys[]={ENTER,ESC,0};
  10.  
  11. main()
  12. {
  13. LEData led;
  14. int Mess;
  15. char buffer[81];
  16.  
  17. Cls(WHITE_BLACK,CLS_ALL);               /* clear screen */
  18. memset(buffer,0,sizeof(buffer));        /* initialize buffer */
  19.  
  20. /* initialize Line Editor structure */
  21.  
  22. LineEditor(LE_INIT,&led);
  23.  
  24. /* modify prompt and field position */
  25.  
  26. led.PRow=led.FRow=12;
  27. led.PCol=25;
  28. led.FCol=35;
  29. led.FLength=20;    /* the field's screen length is of 20 characters */
  30. led.FSize=80;      /* but up to 80 characters can be entered, the data*/
  31.                    /* entry field will scroll automatically */
  32.  
  33. led.Prompt="Filename:";                 /* prompt */
  34. led.CType=CC_PATH | CC_CAPITALIZE;      /* type of valid characters */
  35. led.Buffer=buffer;                      /* use our buffer */
  36. led.ExitKeys=ExitKeys;                  /* our defined exit keys */
  37. PushCursor();                           /* save cursor */
  38. LineEditor(LE_DRAW,&led);               /* draw */
  39.  
  40.   /* Main loop: send ACTIVE message, LineEditor constantly
  41.      returns information */
  42.  
  43. do
  44.      {
  45.      Mess=LineEditor(LE_ACTIVE,&led);
  46.      if(Mess==LE_ILLEGAL_KEY)          /* illegal key? */
  47.           TSound(440,10);              /* beep */
  48.  
  49.      /* loop until an exit key is pressed */
  50.  
  51.      }while(Mess != LE_EXIT_KEY);
  52.  
  53. Cls(WHITE_BLACK,CLS_ALL);               /* clear screen */
  54. }