home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Database / CLIPR503.W96 / GAUGDEMO.PR_ / GAUGDEMO.PR
Text File  |  1995-06-20  |  1KB  |  72 lines

  1. /***
  2. *
  3. *  GaugDemo.prg
  4. *
  5. *  Sample program to demonstrate the use of a bar progress gauge
  6. *
  7. *  Copyright (c) 1993-1995, Computer Associates International Inc.
  8. *  All rights reserved.
  9. *
  10. */
  11.  
  12. #include "Inkey.ch"
  13.  
  14. PROCEDURE GaugDemo
  15.  
  16.    LOCAL i
  17.    LOCAL hGauge
  18.    LOCAL nPercent
  19.  
  20.    CLS
  21.    SET CURSOR OFF
  22.  
  23.    hGauge := GaugeNew( 5, 5, 7, MAXCOL() - 5, "W/B", "W+/B" )
  24.    GaugeDisplay( hGauge )
  25.  
  26.    SETCOLOR( "W+/N" )
  27.    @ 1,0 SAY PADC( "Gauge Demo", MAXCOL() )
  28.  
  29.    SETCOLOR( "W/N" )
  30.    @ 3,0 SAY PADC( "Use , , PgUp and PgDn to change gauge, Esc to exit", MAXCOL() )
  31.  
  32.    nPercent := 0
  33.  
  34.    i := 0
  35.    DO WHILE i <> K_ESC
  36.  
  37.       i := INKEY(0)
  38.  
  39.       DO CASE
  40.       CASE i == K_UP
  41.          nPercent += .01
  42.  
  43.       CASE i == K_DOWN
  44.          nPercent -= .01
  45.  
  46.       CASE i == K_PGUP
  47.          nPercent += .1
  48.  
  49.       CASE i == K_PGDN
  50.          nPercent -= .1
  51.       ENDCASE
  52.  
  53.       // Ensure that nPercent is within bounds
  54.       IF nPercent < 0
  55.          TONE(300, 1)
  56.          nPercent := 0
  57.       ENDIF
  58.  
  59.       IF nPercent > 1
  60.          TONE(300, 1)
  61.          nPercent := 1
  62.       ENDIF
  63.  
  64.       GaugeUpdate( hGauge, nPercent )
  65.  
  66.    ENDDO
  67.  
  68.    SET CURSOR ON
  69.    SETPOS( MAXROW(), 0 )
  70.  
  71.    RETURN
  72.