Progress Bar Example

Jeff Honken jhonken at
Fri Mar 24 18:18:24 EST 2006

  Thanks for the reply.  I've tried using 
load stack URL" but it errors.
I've only been successful with "go"  Here's the code I'm using in a

on mouseUp
  go stack URL ""
end mouseUp

Is there some other syntax for "load" ?


           -----Original Message-----
From: use-revolution-bounces at
[mailto:use-revolution-bounces at] On Behalf Of Sarah
Sent: Friday, March 24, 2006 2:42 PM
To: How to use Revolution
Subject: Re: Progress Bar Example

On 3/25/06, Jeff Honken <jhonken at> wrote:
> I would like to use a "progress bar" to monitor a "go stack URL".  I'm
> clueless on how to write the code.  Does someone have an example of
> or can someone please point me in the correct direction. Jeff

I haven't done it using stacks, but I have done it for downloading
pictures from the web and I guess it's much the same. Firstly, you
need to use "load" instead of "go". This is non-blocking and reports
it's status so you can show what's happening.

Here is part of the handler I use to start a download. It sets the
status callback object to a progress bar and then starts loading. When
it is finished, it's going to call the "picDownloaded" handler.

on downloadFile pAddress
  libURLSetStatusCallback "showStatus", the long ID of sb "Progress"
of stack "Download"
  load URL pAddress with message "picDownloaded"
end downloadFile

In the script of the scrollbar, I have this:

on showStatus pURL, pStatus
  if item 1 of pStatus = "loading" then
    put item 2 of pStatus into tNow
    put item 3 of pStatus into tEnd

    if the visible of sb "Progress" = false then
      -- hasn't started yet
      set the endValue of  sb "Progress" to tEnd
      set the thumbPos of  sb "Progress" to tNow
      show  sb "Progress"
      set the thumbPos of  sb "Progress" to tNow
    end if

  else if pStatus = "error" then
    set the dialogData to empty
    close this stack
   end if
end showStatus

which sets the range of the progress bar and shows it if not already
visible, otherwise it just moves the progress bar. If there is an
error, it gets out.

Back in my download script, I have the handler that gets called after
the download is finished. This is in the same script as the
downloadFile handler:

on picDownloaded pURL, pStatus
    set the dialogData to URL pURL
    unload URL pURL
 end picDownloaded

This puts the newloy downloaded data into a variable (I'm using the
dialogData as it downloads from a separate dialog stack), and then
unloads the file so that it isn't held in two places of memory at

At this point, you could have a "go to stack pURL" line.

Let me know if this doesn't work or if you have any further questions.

use-revolution mailing list
use-revolution at
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:

More information about the Use-livecode mailing list