home *** CD-ROM | disk | FTP | other *** search
-
- /* n4pull.c (c)Copyright Sequiter Software Inc., 1987, 1988, 1989. All rights reserved.
-
- This is the example from routine 'n4pull_down' in the manual.
- */
-
- #include "d4base.h"
- #include "w4.h"
-
- static int do_command( int ) ;
- static int do_display( int ) ;
-
- main()
- {
- int horizontal_ref, sub_one, sub_two ;
- char no_flds[8] ;
-
- d4init() ;
- w4clear(-1) ;
-
- /* Open the database */
- if ( d4use( "TEST.DBF" ) < 0 )
- {
- w4display( "Create a TEST.DBF data file before running this program.", (char *) 0 ) ;
- w4exit(1) ;
- }
-
- /* Calculate some display information */
- c4ltoa( (long) f4num_fields(), no_flds, 6 ) ;
- no_flds[6] = '\0' ;
-
- /* Define the horizontal menu bar */
- horizontal_ref = w4define( -1,-1,-1,-1 ) ;
-
- /* Define the main menu items */
- n4( "Position Database" ) ;
- n4reaction( n4sub_menu ) ;
- n4ptr_save( &sub_one ) ;
-
- n4( "Display" ) ;
- n4reaction( n4sub_menu ) ;
- n4ptr_save( &sub_two ) ;
-
- /* Define the 'Position Database' sub-menu */
- sub_one = w4define( -1,-1,-1,-1 ) ;
- n4( "First Record" ) ;
- n4action( do_command ) ;
-
- n4( "Last Record" ) ;
- n4action( do_command ) ;
-
- n4( "Next Record" ) ;
- n4action( do_command ) ;
-
- /* Define the 'Display' sub-menu */
- sub_two = w4define( -1,-1,-1,-1 ) ;
-
- n4( "Database Record" ) ;
- n4action( do_display ) ;
- n4ptr_save( f4record() ) ;
-
- n4( "Number of Fields" ) ;
- n4action( do_display ) ;
- n4ptr_save( no_flds ) ;
-
- /* Turn the menus into a pulldown menu. */
- n4pulldown( horizontal_ref ) ;
-
- /* Activate the menuing pulldown system */
- w4cursor( -1,-1 ) ;
- n4activate( horizontal_ref ) ;
- w4cursor( 23,0 ) ;
-
- w4close( horizontal_ref ) ;
- w4close( sub_one ) ;
- w4close( sub_two ) ;
-
- d4close_all() ;
- w4exit(0) ;
- }
-
- static int do_command( int item_ref )
- {
- switch( *n4item_text(item_ref) )
- {
- case 'F':
- d4top() ;
- break ;
-
- case 'L':
- d4bottom() ;
- break ;
-
- case 'N':
- d4skip(1L) ;
- break ;
- }
- return 0 ;
- }
-
- static int do_display( int item_ref )
- {
- w4display( (char *) n4ptr_get(item_ref), (char *) 0 ) ;
- return 0 ;
- }
-