Hello,
Perhaps can this lightweight code help ?
on mouseup
load url (Stack_to_load) with message mainstatut
progressbark
end mouseup
on mainstatut
if the cachedurls contains Stack_to_load then
go url (Stack_to_load) in new window
unload url (Stack_to_load)
else answer "La connexion avec le serveur" && quote & "IME" & quote
&& "est rompue." & \
return & "Vérifiez votre configuration d'accès à" &&
"l'internet avant" & return & "de poursuivre..."
end mainstatut
on progressbark
set the thumbposition of sb "jauge" of stack "ime_loader" to "0"
put "0" into aa
repeat 20
if urlstatus(Stack_to_load) is among the items of
"contacted,cached" then
add 10 to aa
set the thumbposition of sb "jauge" of stack "ime_loader" to aa
end if
end repeat
end progressbark
Best Regards,
--
Pierre Sahores
mobile : 06 03 95 77 70
www.sahores-conseil.com
Le 10 juil. 08 à 13:50, Nicolas Cueto a écrit :
Hello,
A few years back, Dave Cragg was
kind enough to explain in detail how
to build a stack that shows the progress
of a download (I've included his message
below).
The script works, but there's a glitch.
When the progress-stack is called up
only its edge can be seen. Its body,
instead of showing a progres bar
increasing as the download progresses,
shows nothing but a freeze-view of whatever
was on the screen beneath it before it
popped open.
I've tried setting buffer properties,
but that did not work.
Is there a way of getting this to work?
Thank you.
-- Nicolas Cueto
<here's Dave Cragg's message and script>
You can show status using "go" as well. libUrlSetStatusCallback works
for both blocking (e.g. load url) and non-blocking (.e.g. get url)
calls.
Below is the script of a *very crude* progress palette. The stack
consists of two fields (one named "url" and the other named
"status"), and a scrollbar (progress bar) named "progress" . Name the
stack "url_status" (or anything you want).
Make this stack a substack of your main stack. Then somewhere (e.g in
your mainstack's preopenstack handler), include the following:
start using "url_status"
That's it. After that, it should work for all downloads and uploads
(which may not be what you want).
Cheers
Dave
--------------------------------------------------
local sUrls
----------------------------
on libraryStack
libUrlSetStatusCallback "urlCallback", the long id of me
palette me
hide me
end libraryStack
-------------------------
on releaseStack
libUrlSetStatusCallback empty
close me
end releaseStack
---------------------------
on urlCallback pUrl, pStatusString
show me
put pUrl into field "url" of card 1 of me
put item 1 of pStatusString into tStatus
put tStatus into field "status" of card 1 of me
put 1 into sUrls[pUrl]
if tStatus is among the items of "loading,downloading,uploading"
then
put item 2 of pStatusString into tPart
put item 3 of pStatusString into tWhole
if tWhole <> empty then
showProgress tPart,tWhole
else
hide scrollbar "progress" of me
put "," && tPart && "bytes" after field "status" of card 1 of me
end if
--unlock screen
else if tStatus is among the items of
"loaded,downloaded,uploaded,cached" then
delete local sUrls[pUrl]
if the visible of scrollbar "progress" of me then showProgress 1,1
send "hideStatus" to me in 200 milliseconds ##leave visible for
short time
else if tStatus is among the items of "error,timeout" then
delete local sUrls[pUrl]
send "hideStatus" to me in 200 milliseconds ##leave visible for
short time
else
hide scrollbar "progress" of me
end if
end urlCallback
-------------------------
on showProgress pPart,pWhole
put the endValue of scrollbar "progress" of me into tMax
set the thumbPosition of scrollbar "progress" of me to round(tMax
* pPart / pWhole)
show scrollbar "progress" of me
wait 10 milliseconds
end showProgress
-----------------------
on hideStatus
if keys(sUrls) is empty then
hide me
end if
end hideStatus
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution