home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c160 / 1.ddi / SOURCE / X4LIST.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-22  |  1.8 KB  |  86 lines

  1.  
  2. /* x4list.c  (c)Copyright Sequiter Software Inc., 1987-1990.  All rights reserved. */
  3.  
  4. #include "d4base.h"
  5. #include "w4.h"
  6.  
  7. #ifndef UNIX
  8.    #include <conio.h>
  9. #endif
  10.  
  11. extern  CB_WINDOW  *v4window_ptr ;
  12.  
  13. x4list()
  14. {
  15.    int   rc, j, hand, len, row ;
  16.    long  field_ref ;
  17.  
  18.    if ( (rc =  d4top()) < 0)  return -1 ;
  19.  
  20.    hand =  w4handle( -2 ) ;
  21.    if ( hand < 0 )   w4clear(0) ;
  22.  
  23.    while ( rc == 0 )
  24.    {
  25.       if ( (rc = x4filter_do()) < 0 )  return -1 ;
  26.       if ( rc )
  27.       {
  28.      #ifndef UNIX
  29.      if ( kbhit() )
  30.         if ( g4char() == 27 )  return 0 ;
  31.      #endif
  32.      if ( (rc = d4skip(1L)) < 0 )  return -1 ;
  33.      continue ;
  34.       }
  35.  
  36.       row =  w4row()+1 ;
  37.       if ( w4col() == 0 )  row-- ;
  38.  
  39.       if ( hand < 0 )
  40.       {
  41.      if ( row >= v4window_ptr->height-1 )
  42.      {
  43.         w4(v4window_ptr->height-1,0, "Press any key to continue ... " ) ;
  44.         w4cursor( w4row(), w4col() ) ;
  45.         if ( g4char() == 27 )  return 0 ;
  46.         row =  0 ;
  47.         w4clear(0) ;
  48.      }
  49.      else
  50.         w4position( row, 0 ) ;
  51.       }
  52.       else
  53.      w4position( row, 0 ) ;
  54.  
  55.       for ( j=1; j <= f4num_fields(); j++ )
  56.       {
  57.      field_ref =  f4j_ref(j) ;
  58.      if ( f4type(field_ref) == 'M' )  continue ;
  59.  
  60.      len =  f4width( field_ref ) ;
  61.      if ( w4col()+len+2 > w4width(-1) )
  62.      {
  63.         len =  w4width(-1) - w4col() ;
  64.         if ( len > f4width(field_ref) )  len =  f4width(field_ref) ;
  65.  
  66.         w4num( row,w4col(), f4ptr(field_ref), len ) ;
  67.         break ;
  68.      }
  69.  
  70.      w4num( row,w4col(), f4ptr(field_ref), len ) ;
  71.      w4position( row, w4col()+2 ) ;
  72.       }
  73.  
  74.       if ( (rc = d4skip(1L)) < 0 )  return -1 ;
  75.       #ifndef UNIX
  76.       if ( kbhit() )
  77.      if ( g4char() == 27 )  return 0 ;
  78.       #endif
  79.    }
  80.  
  81.    if ( hand <= 0 )
  82.       w4cursor( v4window_ptr->height-2, 0 ) ;
  83.  
  84.    return 0 ;
  85. }
  86.