Download progress bar
-
@johnmike You don't need to use a timer for this. In the download callback you can get the progress of the download (see the link I posted before) which returns a value between 0 and 1. Set this as your progress bar panel's value and trigger a repaint. In the panel's paint routine you can use this value as the multiplier for the width of the progress indicator.
-
@d-healey I know it's something obvious that im missing...im very much still wrapping my head around all this...plus im more of a Kinesthetic learner...ive gotten as far as I have watching your vids and learning from recipes and various snippets posted here....I subscribed to your Patreon so I've been digging around over there...plan on just getting your Hise masterclass soon...but the way my life is setup now I just don't have the time to really dig my heels in to make this work...I just need a simple progress bar added to this...Just want the end user to click start on the downloader and see the progress of the download and when it finishes...Im willing to pay you to do it(simple as it may be) Its a small part of a larger project im working on and I don't want to sink too much time getting stuck here trying to learn the panel paint routines...
HiseSnippet 1804.3ocsX0uaaTrEecZWtcMTDHwCvfkJZC3twNMkBD0ay2WhnIXEWJbUIflr6X6Qc7L9NyXmXEEIz8etuV7HviBuAbOmY+vqcVmVEUbkR247wb9c9bmY6nUwLiQo8pE7hoiXd09.+tSk1A6NfxkdGtGRXO04Rghlvzd6LcD0XXId0pcm+EJQsf65498mOaGpfJiYyH448REOl8b9PtcF0Na8cbg3.X6dAeXIo2XqCiUxcUB0X.M2wuk2HZ7qo8YGSQwVw2q16seB2pzcsTKy3U6t6nRl1c.ftT4eI2vOSvvEs85BaTJ4CThDDwHUucGvEIcx8ZiGrKclECtSZL3S7OhmvKnOKV7QNFjYZTNdTak4g2clCdsKCuVkfWEPpVIHc2TH8w9ci07Q1YbP7799GJsLcOJD1KCkTY8V4z22eWEHgzFMj9Z1AZXQgFgeYqVMIveVcy50gPuwRFqEjmRZjnUiNScQTrZ3Zl0NWj7e953KLlKdTLu2SVC1bFS9f0aA9lE9O3eq+v1seX6m.KnHkGG8nMh1XC3oNGEMR1+YIhm1twlYFIIqbx3RLZvfGvErtSMV1vn9LaJ4vRDyK.MHR0r9jQzwFFnXOpvv1zQhdlRammTtg.k5xzSX5nXAiJOfK4lArjhcMD210ViblUB4NsMCm4KgMMOHBnaW0vQJI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WT.mprJ138Pz2jhgxwCOioK+1TTP3v4yehe+keh+xWHINsUujfJ4gRt86GwjK6ZJdYyGfm9gC2Cda.dMgLZfbiXZKGgPs8XSf6bkdog.+8XlWCu9AfVwPEuZ+Cqi68ytRwgCgKY4wgKNbOe2ys8tn7k3lVdw4XOVAge++t0.WWUAkQ+uslT9dNdkr68Rs6GlY2cFasJoyv08yO7aYSu2VkL8wagG9B.uepbbyQpgv1R0SSiYLIErJd+rmyn5rqDZnSXGJ6.ChX1qCn26lAj6XfKCP+9OW.nT4tYS8F7c2w2Vlo1hUXpT4dW36KTDzgJYBGdtueoo2kfzucRIH8G1sluR32tbwJAueIC022Oe21gpg6+es61B2pVkLVPsyeUa76Kjw.5Fm69s3cXkFtcZ4u+v6r6e+1BwO1uC2FOnZLtREXD5Y+6.iYe0h66ueudvz+Y.7t9G7S+87IJ7Read+inVMGpQ7Od7vtvKAhYf0kPoDNMr1J3bqz0sv0XDnKSl3V7WvuLlsw00xX1Nmo2PZrV8qwoyfwuKx8bT.LIceRn.+iv0j1dt4xfd9shZ4MDZC903Xz8eHLJsZcV+VnyitE5rwsPmGeKz4KuE57jagNe0MpCNAZ6wV0vz1AfPm8curpVs8cinbUgd+emYA49.
-
If anyone could help I'd gladly buy your lunch tomorrow or a beer for the weekend he he! LBVS...
-
@johnmike said in Download progress bar:
I don't want to sink too much time getting stuck here trying to learn the panel paint routines...
You've already got the paint routine. You just need to use the download progress from the download callback as the panel's value instead of setting it in a timer.
It's almost identical to what you have already. In your download callback you use
this.getProgress()
which will give you a value between 0 and 1. You assign this as the panel's value, then you call repaint, just like you're doing in your timer.Then in the paint routine, instead of
v = this.getValue() / 10
you can just havev = this.getValue();
. -
@d-healey like so? ```
// pnlProgress Content.getComponent("pnlProgress"); pnlProgress.setValue(0); this.getProgress(); var x = this.getValue(); x = (x + 1) % 11; this.setValue(x); this.repaint(); pnlProgress.setPaintRoutine(function(g) { g.fillAll(Colours.black); var a = [this.getWidth() / 2 - 400 / 2, this.getHeight() / 2 - 20 / 2, 400, 20]; g.setColour(Colours.darkgrey); g.fillRoundedRectangle(a, 5); var v = this.getValue(); g.setColour(Colours.white); g.fillRoundedRectangle([a[0], a[1], a[2] * v, a[3]], 5); v > 0.52 ? g.setColour(Colours.black) : g.setColour(Colours.lightgrey); g.drawAlignedText(v * 100 + "%", a, "centred"); }); }
I'm still not seeing it do anything...where do I assign the panel's value? I appreciate you helping me...
-
@johnmike The first snippet you posted, did you write that code?
-
@d-healey yea but did so following your downloader tutorial and your panel timer tutorial on your Patreon just typing it in as you went...but my 40-year old brain isn't making the connection between the 2 yet ha ha
-
so I did both separate and then copied and pasted one into the other
-
@johnmike Ah copy and paste to create a Frankenstein code is always dangerous :)
The download callback is the part that starts with
function downloadCallback()
Inside the download callback you need to get the progress of the download and assign it as the panel's value. This is pretty much the same as you are doing in your timer callback, except there you are using
x
. Then you need to call the panel's repaint function.The paint routine is the part that starts with
pnlProgress.setPaintRoutine(function(g)
In the paint routine you just need to do what I said in my last post :)
I could do this for you, but then you will come back with more questions when you want to change something or you find a bug. You need to be in control of your own script.
-
Ok gonna try this and go back to the "drawing" board again!
I could do this for you, but then you will come back with more questions when you want to change something or you find a bug. You need to be in control of your own script.
Absolutely! I totally get it!I taught music for almost 15 years before I started my online business...this is like learning scales all over again lol! The student wants you to just jump and show them the sexy jazz chords and runs...but hasn't yet fully learned the theory and foundation behind those chords/runs...which would make them a better and more skilled Musician being able to create and imagine their own chords/runs...I get it lol :expressionless_face:
-
@johnmike Ok well you cant just copy and paste code out of the documentation and expect it to work...
FileSystem.browseForDirectory(var startFolder, var callback)
- you need to specify a value for startFolder, even an empty string will do
- you need to define a function for callback, that function will need a single param called result -this will be a file object, in this case a Directory - that you can manipulate and check in your function...
// get the folder WeDontUSeThis = FileSystem.browseForDirectory("", function(result){ MyDownloadFolderString = result.toString(FullPath); Console.print( MyDownloadFolderString); });