Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

How to do a progress bar?

 [1/6] from: bpaddock:csonline at: 3-Sep-2001 7:38


I'd like to add a progress bar to my patent downloading program (if you've been following that thread). I've looked at progress.r in the script library, and several other examples that I could find of progress bars. easy-vid.r, source request-download, read-net, read-thru etc... Unfortunately they have left me confused because they are full of mystery constants with no explanation as to what they are for, or they look recursive: progress: layout[ p:progress... I have the following loop, where LastPage is what it says, say 7 for example. I want to light one more block on the bar for each time CurrentPageNumber goes up. How do I get there? repeat CurrentPageNumber to-integer LastPage [ GetPageURL: to-url rejoin[ "http://" pdf-url to-string CurrentPageNumber ] print GetPageURL OutputNameFILE: probe to-file rejoin[ "US" PatentNumber "pg" CurrentPageNumber ".pdf" ] write/binary OutputNameFILE read/binary GetPageURL ] Also does any one know what read-net reads? Is it binary or text? Rebol looks like it has a lot of potential, but I'm disappointed that it takes so much digging in the docs to find how to do any thing, and in the end still have to come to the list and bother people for help. Case in point read-net: Description ??? , and thats what it says "???" for the description. :-(

 [2/6] from: sanghabum:aol at: 3-Sep-2001 8:56


Hi Bob, [bpaddock--csonline--net] writes:
> I'd like to add a progress bar to my patent downloading program (if you've > been following that thread).
Try this example, it's about as simple as it gets. the magic parameter is the /data variable which goes from 0 (no bar) to 100 (solid bar) ========= unview/all No-of-steps: 100 view layout [ Mybar: progress 300x30 Button "Do bar " [ Mybar/data: 0 loop no-of-steps [ mybar/data: mybar/data + (1 / No-of-steps) show mybar wait 0.01 ]; loop ] ; action ] ; layout =========
> Rebol looks like it has a lot of potential, but I'm disappointed that it > takes so much digging in the docs to find how to do any thing, and in the > end > still have to come to the list and bother people for help.
You're not the first to notice the docs problem......Every language has its Achilles' heel, and Rebol's is its lack of documentation. That's strangely ironic given RTs mission statement ("We dramatically improve the way people collaborate, communicate, share, and process information across all Internet systems") --Regards, --Colin.

 [3/6] from: allenk:powerup:au at: 3-Sep-2001 23:04


> Also does any one know what read-net reads? Is it binary or text? > > Rebol looks like it has a lot of potential, but I'm disappointed that it > takes so much digging in the docs to find how to do any thing, and in the
end
> still have to come to the list and bother people for help. Case in point > "read-net: Description ???", and thats what it says "???" for the > description. :-(
What do mean? read-net has a full description using help. ? read-net USAGE: READ-NET url /progress callback DESCRIPTION: Read a file from the net (web). Update progress bar. Allow abort. READ-NET is a function value. ARGUMENTS: url -- (Type: url) REFINEMENTS: /progress callback -- Call func [total bytes] during transfer. Return true. (Type: any)

 [4/6] from: cybarite:sympatico:ca at: 3-Sep-2001 8:51


[REBOL] How to do a progress bar? Bob, I don't know about the documentation you ask about. I had some of the same concerns on documentation so have put some notes that I have collected in an easyvid format. See rebsite cybarite/VID Usage then on the navigation side, scroll down to the "Progress Indicator" example. That example shows how a slider and a progress indicator and a text field work together. Having said that I think a progress indicator only makes sense if you know the progress i.e. the time for each step. If the files are all the same size, then a progress indicator would give a reasonable visual indicator. But when the work effort is arbitrarily chunked as it can be with various file sizes, a progress indicator will usually be mis-leading. The way to deal with this would be to get all of the file sizes then estimate that each file will download in relation to its file size. After doing this, a progress indicator might give a good hint of progress. If unpredicatable load is the case, then a simplier solution might be more informative e.g. display a text message that says Downloading file i of n This does not have to be to the console transcript but could be in a View display.

 [5/6] from: bpaddock:csonline at: 3-Sep-2001 9:35


> What do mean? read-net has a full description using help.
http://www.rebol.com/docs/dictionary.html describes read-net as I quote: Description: ??? I ask because 'read' has a /binary refinment, and documents such. read-net says nothing about a /binary refinment making me assume it only does text.

 [6/6] from: ammoncooke::yahoo::com at: 3-Sep-2001 9:07


at the REBOL console type: ? read-net The result: USAGE: READ-NET url /progress callback DESCRIPTION: Read a file from the net (web). Update progress bar. Allow abort. READ-NET is a function value. ARGUMENTS: url -- (Type: url) REFINEMENTS: /progress callback -- Call func [total bytes] during transfer. Return true. (Type: any) USAGE: READ-NET url /progress callback DESCRIPTION: Read a file from the net (web). Update progress bar. Allow abort. READ-NET is a function value. ARGUMENTS: url -- (Type: url) REFINEMENTS: /progress callback -- Call func [total bytes] during transfer. Return true. (Type: any)