-
jsProgressBar Control – not really controlling progress…
Dear $all,
I have some tasks (e.g. doing a few thousand REST API calls) that take an awful long time to finish.
So in order to see if the process is still alive, I thought it would be a good idea to implement a window showing the progress of my task. So I had a look at the sample ‘JS Progress’.
While the sample works as is, my attempt to link the progress bar to the time-consuming task did not work.
In the original sample, the counter (Calculate <b style=”font-family: inherit; font-size: inherit; color: var(–bb-body-text-color);”>iValue as <b style=”font-family: inherit; font-size: inherit; color: var(–bb-body-text-color);”>iValue+5) takes place WITHIN the CarryOn event:
On evCarryOn
If not(iCancelled)
Calculate iValue as iValue+5
Do $cinst.$objs.ProgressBar.$::value.$assign(iValue)
If iValue<100
Do $cinst.$objs.ProgressBar.$sendcarryon.$assign(kTrue)
Else
Do $cinst.$clientcommand("lockui",row()) ## unlock ui
End If
End If
To me, this makes no sense, since the progress bar is supposed to display the progress of some other method, i.e. OUTSIDE of the CarryOn event. So I call that method (<b style=”font-family: inherit; font-size: inherit; color: var(–bb-body-text-color);”>$doSomethingMassive) from the event of the Start button:
On evClick
Do $cinst.$clientcommand("lockui",row(kTrue))
Calculate iCancelled as kFalse
Calculate iValue as 1
Do $cinst.$objs.ProgressBar.$sendcarryon.$assign(kTrue)
Do method $doSomethingMassive
and that method (<b style=”font-family: inherit; font-size: inherit; color: var(–bb-body-text-color);”>$doSomethingMassive) is – here – quite simple:
For iValue from 1 to 100
Do $cinst.$objs.ProgressBar.$sendcarryon.$assign(kTrue)
Do sleep(50)
End For
I would have assumed that raising that CarryOn event from within <b style=”font-family: inherit; font-size: inherit; color: var(–bb-body-text-color);”>$doSomethingMassive would update my progress bar DURING the execution of <b style=”font-family: inherit; font-size: inherit; color: var(–bb-body-text-color);”>$doSomethingMassive – but only AFTER the execution the bar goes to 100 at once.
So what good is a progress bar that is really only a finish bar 😉 ?
But I suppose I am doing something wrong, as usual…
Any ideas?
Best regards
Uwe
PS: I have attached the slightly modified sample ‘JS Progress’
Log in to reply.