home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a009 / 6.ddi / SAMPLE.LIF / GAUGDEMO.PRG < prev    next >
Encoding:
Text File  |  1991-04-14  |  1.0 KB  |  65 lines

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