Author Topic: Another sample of progressbar/Trackbar in ASCII, customizable  (Read 3273 times)

0 Members and 1 Guest are viewing this topic.

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Hi guys
here I post a demonostration of ProgressBar customizable in ASCII output

Code: QB64: [Select]
  1. For a = 1 To 30
  2.     MakeProgressionBar a, 1, 20, 10, 10, 3, 1, 20
  3.     MakeProgressionBar a, 1, 40, 10, 15, 14, 1, 20
  4.     MakeProgressionBar a, 1, 30, 10, 20, 1, 1, 50
  5.     MakeProgressionBar a, -10, 30, 10, 24, 5, 1, 70
  6.     _Delay .5
  7.  
  8. 'MakeprogressionBar is a sub that makes as output a progression bar with colored the part showing the value num on the total L
  9. ' num is the value to show
  10. ' min and max are boundaries of the range in which num stands
  11. ' x and y are the row and column where progressionbar is showed
  12. ' cfill is the color of filled part
  13. ' Nmin and NMax are the boundaries of the new range in which num must be showed
  14. Sub MakeProgressionBar (num As Integer, min As Integer, max As Integer, x As Integer, y As Integer, cFill As Integer, nMin As Integer, nMax As Integer)
  15.     Dim nVal As Integer, nRange As Integer
  16.     nRange = (nMax - nMin) + 1
  17.     nVal = CInt((nRange * num) / ((max - min) + 1))
  18.     If nVal <= nRange Then
  19.         Color 15, 0: Locate y, x: Print String$(nRange, "²");
  20.         Color cFill, 0: Locate y, x: Print String$(nVal, "²");
  21.     End If
  22.     Color cFill, 0: Locate y, x - Len(LTrim$(Str$(num))): Print num;
  23.  

Thanks to try
Programming isn't difficult, only it's  consuming time and coffee