home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / CODE4-4.ZIP / HDR_EXMP.ZIP / EXAMPLES.ZIP / N4PULL.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-05-17  |  1.6 KB  |  69 lines

  1.  
  2. /*  (c)Copyright Sequiter Software Inc., 1987, 1988, 1989. All rights reserved. 
  3.  
  4.     This is the example from routine 'n4pull_down' in the manual.
  5. */
  6.  
  7. #include "d4base.h"
  8. #include "w4.h"
  9. #include <stdlib.h>
  10.  
  11. main()
  12. {
  13.    int  horizontal_ref, sub_one, sub_two ;
  14.    char no_flds[20], *rec_ptr ;
  15.  
  16.    w4clear(-1) ;
  17.  
  18.    /*  Open the database */
  19.    if ( d4use( "D4LEARN.DBF" ) <  0 )  exit(1) ;
  20.  
  21.    /*  Calculate some display information */
  22.    itoa( f4num_fields(), no_flds, 10 ) ;
  23.    rec_ptr =  f4record() ;
  24.  
  25.    /*  Define the horizontal menu bar */
  26.    horizontal_ref =  w4define( -1,-1,-1,-1 ) ;
  27.  
  28.    /*  Define the main menu items */
  29.    n4( "Position Database" ) ;
  30.    n4reaction( n4activate, &sub_one ) ;
  31.  
  32.    n4( "Display" ) ;
  33.    n4reaction( n4activate, &sub_two ) ;
  34.  
  35.    /*  Define the 'Position Database' sub-menu */
  36.    sub_one =  w4define( -1,-1,-1,-1 ) ;
  37.    n4( "First Record" ) ;
  38.    n4action( d4top ) ;
  39.  
  40.    n4( "Last Record" ) ;
  41.    n4action( d4bottom ) ;
  42.  
  43.    n4( "Next Record" ) ;
  44.    n4action( d4skip, 1L ) ;
  45.  
  46.    /*  Define the 'Display' sub-menu  */
  47.    sub_two =  w4define( -1,-1,-1,-1 ) ;
  48.  
  49.    n4( "Database Record" ) ;
  50.    n4action( w4display, rec_ptr, (char *) 0 ) ;
  51.  
  52.    n4( "Number of Fields" ) ;
  53.    n4action( w4display, no_flds, (char *) 0 ) ;
  54.  
  55.    /*  Turn the menus into a pulldown menu. */
  56.    n4pulldown( horizontal_ref ) ;
  57.  
  58.    /* Activate the menuing pulldown system */
  59.    w4cursor( -1,-1 ) ;
  60.    n4activate( &horizontal_ref ) ;
  61.    w4cursor( 23,0 ) ;
  62.  
  63.    w4close( horizontal_ref ) ;
  64.    w4close( sub_one ) ;
  65.    w4close( sub_two ) ;
  66.  
  67.    exit(0) ;
  68. }
  69.