Page 1 of 1

Progress Bar Speed Issue!?

Posted: Tue Jun 02, 2015 1:40 pm
by antrax13
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.

Re: Progress Bar Speed Issue!?

Posted: Tue Jun 02, 2015 4:56 pm
by jacque
Is the screen locked?

Re: Progress Bar Speed Issue!?

Posted: Tue Jun 02, 2015 4:59 pm
by dunbarx
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

Re: Progress Bar Speed Issue!?

Posted: Tue Jun 02, 2015 5:04 pm
by zaxos
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.

Re: Progress Bar Speed Issue!?

Posted: Wed Jun 03, 2015 9:13 am
by antrax13
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.

Re: Progress Bar Speed Issue!?

Posted: Wed Jun 03, 2015 9:18 am
by antrax13
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

Re: Progress Bar Speed Issue!?

Posted: Wed Jun 03, 2015 3:25 pm
by dunbarx
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

Re: Progress Bar Speed Issue!?

Posted: Wed Jun 03, 2015 5:23 pm
by jacque
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.