2023-08-31 11:45 PM
Hi,
I'm working on a screen where in I need to display both down timer (using text box) and a line progress bar.
I want the progress bar to fill along with the down timer.
Example : Lets say my timer is running down for 10 seconds, I want the line progress to complete filling within 10 seconds.
Can somebody please suggest how this can be achieved?
I feel passing the right value to setvalue will be the solution for this issue.
ProgressBar.setValue(tick + 1);
ProgressBar.invalidate();
Please guide.
2023-09-01 04:38 AM
Hello @KNara.2 ,
Yes, your solution is correct. Just to mention you don't need to use invalidate(). The setValue() suffices.
You can also read more about the Progress Indicators here:
https://support.touchgfx.com/docs/category/progress-indicators
2023-09-02 09:49 AM
Any timing on screen can be handled from model tick over MVP or simpler in screen implement
virtual void handleTickEvent();
2023-09-02 04:52 PM
Thank you @Mohammad MORADI ESFAHANIASL and @MM..1 .
I'm on the right track as suggested by you both I'm using setValue() to get the progress bar indicator moving and using handletickevent() to keep the timer up and running.
I'm only stuck at keeping the progress bar indicator filling in sync with down timer.
2023-09-03 02:57 AM
All is based on your design , but simply when you start timer you too call
lineProgress.setRange(0, calculated timer2bar max);
and in tick events you set value together with set label
2023-09-04 06:40 AM
@MM..1 Thanks for pointing to
lineProgress.setRange(0, calculated timer2bar max);
I was looking at the AbstractProgressIndicator.hpp ....function description above setRange();
it says if your box is 200 pixels wide and "0%" is 40 pixels wide.
How this calculation done?
Line progress bar in my case is 344 pixels.
Does it mean 68 pixels wide is 0%?
2023-09-04 08:43 AM
You waste time. Test and see. I mean range is values you need use. Lib recalc it to pixels, you dont require this.
Example you set range 0, 5 and visual size is 344 then simple if 0 is set no progress, if 1 ..344/5 pixels ...
If your code require can you set range -33 to +33 ...