cancel
Showing results for 
Search instead for 
Did you mean: 

Line progress bar progress along with timer.

KNara.2
Associate III

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.

6 REPLIES 6

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  

Mohammad MORADI
ST Software Developer | TouchGFX
MM..1
Chief III

Any timing on screen can be handled from model tick over MVP or simpler in screen implement

virtual void handleTickEvent();
KNara.2
Associate III

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.

MM..1
Chief III

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

KNara.2
Associate III

@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%?

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 ...