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 / SELECT.C < prev    next >
C/C++ Source or Header  |  1991-03-26  |  2KB  |  44 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <conio.h>
  4. #include <string.h>
  5.  
  6. #define __TCUPRE32__
  7. #include <usr\tcu.h>            /* Utilities include file */
  8.  
  9. void main (void)
  10. {
  11.    int           age_id,        /* To hold field ID of age form field */
  12.                  pos_x, pos_y,  /* Position for the form */
  13.                  rkey;          /* Key used to exit form */
  14.    FORM          form;          /* Form object */
  15.    FIELD_INFO    info;          /* Field information structure */
  16.    FORM_INFO     f_info;        /* Form information structure */
  17.  
  18. /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
  19.  
  20.    set_mouse_mode (1);
  21.  
  22.    load_form (&form, "sample");              /* Load form from CUF file */
  23.  
  24.    get_field_id (&form, "age", &age_id);     /* Get age field ID */
  25.  
  26.    get_form_info (&form, &f_info);           /* Get form information */
  27.    pos_x = 81-f_info.width;                  /* Calculate where to put */
  28.    pos_y = 26-f_info.height;                 /* the form. */
  29.  
  30.    display_form (&form, pos_x, pos_y);/* Display the form and allow */
  31.  
  32.    select_field (&form, age_id, &rkey);    /* Select a field */
  33.  
  34.    remove_form (&form);           /* Remove the form from screen */
  35.  
  36.    if (rkey >= 0) {
  37.       get_field_info (&form, rkey, &info);
  38.       printf ("User selected field %d (%s)\n", rkey, info.name);
  39.    } else
  40.       printf ("User aborted from field select\n");
  41.  
  42.    unload_form (&form);           /* Unload the form definition from memory */
  43. }
  44.