View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0036471||Lazarus||LCL||public||2019-12-22 13:42||2019-12-22 21:28|
|Reporter||Pantey||Assigned To||Bart Broersma|
|Status||resolved||Resolution||no change required|
|Summary||0036471: TProgressBar always shows wrong progress at increasing position, but shows correctly at decreasing position.|
|Description||TProgressBar always shows wrong progress at increasing position, but shows correctly at decreasing position.|
This is not very noticeable with a large number of small increments, but it is clearly visible with several large increments.
There is an attached simplified example (with no any other tasks) demonstrating a problem.
A StaticText.Caption shows a value from ProgressBar.Position, but ProgressBar shows bar at the previous position.
The proportions of the increment of steps are violated, but the final value of 100% is achieved by a large jump.
|Tags||No tags attached.|
|Fixed in Revision|
PB-Problem.zip (952,507 bytes)
Windows animates the progression of the increase of Position.
Your Sleep(2000) prevents showing this animation taking place at the time you expect it.
Only on the next iteration the progressbar will go to the position that it was set to in the previous iteration.
Because animation does NOT take place if you decrease Position, you get the immediate result you want.
If you do the following, you will see that it works as "expected" (it's a really annoying feature of Windows and you can't seem to turn that off).
In the Buttons OnClick simply increase Position by 25 (no loop, no ApplicationProcessMessages).
Click the button 4 times (not to fast) and see how the progressbar "grows" to the expected position.
Set Positions to DesiredValue + 1, then Position to DesiredValue,
Does of course not work if DesireValue equals Max
Use a custom ProgressBar. There are plenty of them out there.
||Please close this issue.|
Thank you for quick answer!
Sleep(2000) in my example works instead of my own intensive task with file system, which has absolutely the same behavior like Sleep(2000).
If there is nothing to do due to Windows behavior then it is sadly. In this case only two ways:
1) to incapsulate my task into some thread (which is not so easy),
2) to use something else instead of ProgressBar.
Try ATGauge in ATFlatControl package.
|2019-12-22 13:42||Pantey||New Issue|
|2019-12-22 13:42||Pantey||File Added: PB-Problem.zip|
|2019-12-22 16:47||Bart Broersma||Note Added: 0120022|
|2019-12-22 16:47||Bart Broersma||Assigned To||=> Bart Broersma|
|2019-12-22 16:47||Bart Broersma||Status||new => resolved|
|2019-12-22 16:47||Bart Broersma||Resolution||open => no change required|
|2019-12-22 16:47||Bart Broersma||LazTarget||=> -|
|2019-12-22 16:47||Bart Broersma||Widgetset||Win32/Win64 => Win32/Win64|
|2019-12-22 16:47||Bart Broersma||Note Added: 0120023|
|2019-12-22 17:19||Pantey||Note Added: 0120024|
|2019-12-22 21:28||CudaText man||Note Added: 0120028|