Progress Bar

Moderators: LCNeil, heatherlaine, kevinmiller, elanorb

Post Reply
pTom
Posts: 40
Joined: Wed Sep 18, 2013 10:44 pm

Progress Bar

Post by pTom » Fri Nov 01, 2013 3:45 am

Hello all!

I am adding a progress bar to my "Upload" stack and am having a few issues.

Here is my code on the card:

Code: Select all

on displayProgress
   --Progress bar
   global gFilePath
   put URLStatus(field "fileField") into theStatus
   show group "Progress Bar"
   switch item 1 of theStatus
      case "loading"
         set the thumbPosition of sb "Progress" of group "Progress Bar" to the round of (item 2 of theStatus / item 3 of theStatus * 100)
         put the round of (item 2 of theStatus / 1024) && "KB loaded" && the round of (item 3 of theStatus / 1024) into field "status"
         send "displayProgress" to me in 1 second
         break
      case "cached"
         put URL field "fileField" into URL ("file:" & gFilePath)
         cleanUp
         break
      case "error"
         answer "Error" & return theStatus
         break
      default
         send "displayProgress" to me in 1 second
         break
   end switch
end displayProgress
And here is my code on the "Upload" button:

Code: Select all

on mouseUp
   global gFilePath
   set the itemDel to "/"
   put last item of field "fileField" into gFilePath
   load URL field "fileField"
   displayProgress
   uLoad
end mouseUp
My problem is that I always receive an error, however, the file always uploads. The progress bar displays but does not move. Weird..

Also, I would rather have the progress bar float above the current window during upload in it's own message window. I can't find anywhere in the forums or lesson info on how to accomplish this. I am fine with hiding and showing the progress bar each time I load, but would prefer the floating window idea.

Any ideas?

Thanks

Tom

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Progress Bar

Post by LCNeil » Fri Nov 08, 2013 2:47 pm

Hi Tom,

Are you trying to display progress on the desktop or mobile device? The scrip you have implemented uses "URLstatus" which is desktop specific. If you wish to have callback from a mobile upload you will need to use "urlProgress"

A lesson that explains how to dispaly the progress of a mobile upload can be viewed here -

http://www.livecode.com/academy/livecod ... cademy/37/

As you are part of the idea2app course, you should have access to these buisness app academy videos.

Kind Regards,

Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
LiveCode – Realize fast, compile-free coding
--

pTom
Posts: 40
Joined: Wed Sep 18, 2013 10:44 pm

Re: Progress Bar

Post by pTom » Fri Nov 08, 2013 6:45 pm

Hi Neil

I watched the video and found it very helpful. However, I can't figure out why my progress bar won't move...weird. I am using it on a desktop application for the purpose of loading content to the server for use by the mobile app.

Any advice on this one?

Thanks

Tom

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Progress Bar

Post by LCNeil » Mon Nov 11, 2013 5:39 pm

Hi Tom,

Could you place the semi-working script in a sample stack as this will allow me to step through the code in order to find out what is going wrong.

You can remove your FTP details as I should be able to use my own.

Kind Regards,

Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
LiveCode – Realize fast, compile-free coding
--

Post Reply

Return to “idea2app and Coding School”