Progress Bar Speed Issue!?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
antrax13
Posts: 39
Joined: Mon Jun 01, 2015 11:38 am

Progress Bar Speed Issue!?

Post by antrax13 » Tue Jun 02, 2015 1:40 pm

Hi,
I feel really sorry to spam this forum but I always get this type of error that no one else experience them before :D

I can not even describe the issue but I will give it a try.

The issue is that my progress bar is not updating during repeat loop continuously.
It will get updated only when last item is done. So as it stands livecode progress bar is either empty or 100% full.
As soon as I put answer "blabla" in the middle of the loop my progress bar starts to get updated
1,2,3,4...100% but asap I will comment this line out like I mentioned I see only empty or 100%.
That is impossible because I am trying to update DB with 1000 lines and it takes about 5 seconds when I see answer "completed".

It seems like livecode doesnt have enough time to update screen with correct thumbPosition

My code

Code: Select all

on saveLocation 
   put the number of lines of fld "fldValues" into tNumOfLines
   set the endValue of scrollbar "progressBar" to tNumOfLines
   put 0 into tCurrentValue
   repeat for each line x in field "fldValues"
      wait 20 milliseconds with messages
      -- database work for create records
      
      --answer it
      --answer x 
      add 1 to tCurrentValue
      put tCurrentValue into field "counter"  /* Just a test to see if field will be updated/changed with => its not */
      set the thumbPosition of scrollbar "progressBar" to tCurrentValue
      if tCurrentValue is tNumOfLines then
         answer "Completed."
      end if
   end repeat
end saveLocation
Any help will be appreciated.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7403
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Progress Bar Speed Issue!?

Post by jacque » Tue Jun 02, 2015 4:56 pm

Is the screen locked?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10394
Joined: Wed May 06, 2009 2:28 pm

Re: Progress Bar Speed Issue!?

Post by dunbarx » Tue Jun 02, 2015 4:59 pm

Hmmm.

Something unusual is going on. I made a test handler very similar to yours, and it works fine with a progress bar or a slider, but not with a scrollbar. Please test your handler with a progress bar and write back.

I am in 6.7.4 with OSX 10.9.

Craig Newman

zaxos
Posts: 222
Joined: Thu May 23, 2013 11:15 pm

Re: Progress Bar Speed Issue!?

Post by zaxos » Tue Jun 02, 2015 5:04 pm

Have you tried testing it as a standalone? I had similar problems when using repeat loops, sometimes it dosent work in the IDE but works as expected as a standalone.
Knowledge is meant to be shared.

antrax13
Posts: 39
Joined: Mon Jun 01, 2015 11:38 am

Re: Progress Bar Speed Issue!?

Post by antrax13 » Wed Jun 03, 2015 9:13 am

Hi guys,

I tried locking the screen, standalone app and had the same issue.
Then without adding locking or changing anything in the code above, it worked only once. So I replicate that and it wasnt working again. Replicate couple of times and it seems to work randomly. Once it's running OK so progress bar is updated continuously and other time progress bar is updated only once at the end of the loop.

No idea what is going on. I will try it again on different machine when I get home.

Thanks for suggestions and help, much appreciated.

antrax13
Posts: 39
Joined: Mon Jun 01, 2015 11:38 am

Re: Progress Bar Speed Issue!?

Post by antrax13 » Wed Jun 03, 2015 9:18 am

dunbarx wrote:Hmmm.

Something unusual is going on. I made a test handler very similar to yours, and it works fine with a progress bar or a slider, but not with a scrollbar. Please test your handler with a progress bar and write back.

I am in 6.7.4 with OSX 10.9.

Craig Newman
What you mean by test it with progress bar? I am using progress bar

Code: Select all

set the endValue of scrollbar "progressBar" to tNumOfLines
type of this object is progress bar

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10394
Joined: Wed May 06, 2009 2:28 pm

Re: Progress Bar Speed Issue!?

Post by dunbarx » Wed Jun 03, 2015 3:25 pm

Hi.

I mis-spoke.

Anyway, you may find that scaling the progress bar will solve your problems. Make a new one. Set its end value to a high number, like 8000. Make a button. Put this into its script:

Code: Select all

on mouseUp
   set the thumbpos of scrollbar 1 to 1
   put 1 into tCurrentValue
   repeat 8
            wait 20 milliseconds with messages
            add 1000 to tCurrentValue
            set the thumbPosition of scrollbar 1 to tCurrentValue
   end repeat
end mouseUp
There are issues with small values of the end value in relation to the width of the thumb. These all go away if you scale your numbers. Others may chime in with more useful information about that.

Crfaig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7403
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Progress Bar Speed Issue!?

Post by jacque » Wed Jun 03, 2015 5:23 pm

It doesn't sound like a problem with the progress bar because the field text isn't updating either. It sounds like the screen has been locked and isn't unlocked until the handler completes.

Edit: I just saw that you tried locking the screen, but that is what will prevent the bar from updating. I think another handler is locking it and not unlocking while your progress update occurs.

Try putting an "unlock screen" command before you set the thumb position. Also move the wait command to just after the thumb is set, sometimes LC needs that to redraw the screen. Then you can lock it again immediately afterwards if you don't want the user to see other changes.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply