3 Replies - 515 Views - Last Post: 28 October 2020 - 11:20 PM

#1 Matthew200   User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 49
  • Joined: 20-August 20

How to keep count of how many times a list of items refreshes?

Posted 20 October 2020 - 10:40 PM

Hi there, I have a little stopwatch project in which you can save 10 laps.
Once you have reached the 10th, the 11th will overwrite the 1st it was saved, and so on.
What I wanna do is: for the first cycle of 10 the laps, one by one the laps appear with a blue background, for the second cycle, one by one appear with a green background, for the third cycle, back to blue and so on. So you can see more easily what is the last lap that was saved.

I'm sorry I don't have to code rn. Any chances you can give me an advice without it? Thanks!

This post has been edited by Matthew200: 20 October 2020 - 10:41 PM


Is This A Good Question/Topic? 0
  • +

Replies To: How to keep count of how many times a list of items refreshes?

#2 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4290
  • View blog
  • Posts: 13,601
  • Joined: 08-June 10

Re: How to keep count of how many times a list of items refreshes?

Posted 21 October 2020 - 01:29 AM

Quote

Once you have reached the 10th, the 11th will overwrite the 1st it was saved, and so on.

Rather than that I'd remove the 1st lap before/after adding the 11th lap. like an RRD (logging systems use that quite a lot). With that you don't have to come up with new colour combinations as the laps continue, it just displays the last ten laps.
Was This Post Helpful? 1
  • +
  • -

#3 ArtificialSoldier   User is online

  • D.I.C Lover
  • member icon

Reputation: 2875
  • View blog
  • Posts: 8,275
  • Joined: 15-January 14

Re: How to keep count of how many times a list of items refreshes?

Posted 21 October 2020 - 10:21 AM

Right, that sounds like a FIFO buffer with 10 items. If you want to color-code them you can also have a counter that keeps track of the current lap number, which you can use to figure out the lap number of any one of the 10.
Was This Post Helpful? 0
  • +
  • -

#4 ishan.shah   User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 56
  • Joined: 28-March 19

Re: How to keep count of how many times a list of items refreshes?

Posted 28 October 2020 - 11:20 PM

You can declare a local variable with value 0 and add increment to it in the loop, that`s how you will get exact number of your loop execution counter.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1