Count down, then up

I’m responsible for running a lot of Zoom meetings with up to 20 speakers. I couldn’t find any good timer software to manage this so decided to write my own in Xojo.

I’ve got the part down where I click a button by someone’s name to start a timer counting down to zero. However, when the timer gets to 0 I want it to start counting up and displaying the word “OVER TIME” in red, preferably flashing, text.

Not quite sure of the best approach to take on this.

Also, I have 20 variables such as SpeakerTime1, SpeakerTime2 etc. Rather than attaching code to each of them, I assume I can just create a function and then pass the name of the object, something like StartTimer(SpeakerTime3) and StopTimer(SpeakerTime3) but not quite sure how to write the function to receive an object rather than a variable or value.

Thanks

Keep counting down and when it goes negative, display the absolute value in red.

3 Likes

Sounds like a case for an array or a dictionary.

Start with your Speaker Class.
Give it access methods…
Maybe StartTimer
StopTimer
ResetTimer
GetRemainingTime()
and so on
and a property or two… eg SpeakerName

Create an array or dictionary
Create a new object of type Speaker - it will begin life with a default amount of time, either as an IDE- set default value, or set in the Constructor

Add this object to your array or dictionary.

Your ‘start or stop’ methods would be

Sub StartTimer( s as SpeakerClass)
''do what you want to this instance
end sub

And you can cycle through all your speakers by looping the array or iterating the dictionary.

Thanks. This will do the trick nicely!

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.