Pause the stopwatch component with costume button, is it possible?

Hi all,
I am still using Glide classic (build my app before they launched Apps and continued because the main use is the stopwatch component).
I am using CSS to hide the original buttons(PAUSE / START / STOP) and use costume buttons for START/RESET only.
I would like to use another button to PAUSE the stopwatch.
and then SUM the total time the user pressed START-PAUSE-RESUME-PAUSE and so on.

How to create the PAUSE function? Thank you.

If I recall, when you start the stopwatch it records the start time. When you pause it, it clears the start time and records the duration that the stopwatch ran. If you resume the stopwatch, I think it keeps the duration but records the new start time and does some behind the scenes math to add the current duration to the previous recorded duration. Clicking on Stop will clear both the start time and the duration.

So are you saying that you want to keep track on the total time the stopwatch is running as well as the total time that it is paused? If so, that might get tricky. You would somehow need a button with an action that will somehow control the stopwatch as well as fill a second set of start date and duration columns. Iā€™m not sure thatā€™s even possible.

1 Like

Thank you, Iā€™ll try to make it more clear with an example.

A. I use ā€œcostumeā€ button for START =

  1. set column values of ā€˜current timeā€™.
  2. Current time starts the stopwatch from 00:00.

B. And ā€œcostumeā€ button for END =

  1. set column values - clear start time.
  2. Set column values of ā€˜current timeā€™

Then I can calculate the time between A1 TO B2.

The pause button is hidden be css.
I would like the user to press ā€˜costumeā€™ PAUSE button and
START button and to calculate the overall time.

Example:
START: 1:30 MIN then pause.
2nd START:2 MIN then pause.
Total time: 3:30 min.

Thank you.

The native stopwatch buttons do that. If you read through my explanation of the process in my previous post, you will see that pausing the stopwatch clears the start time and sets the duration. If you start again, it will keep the duration but add the new start time. To calculate total time, you need to do the same thing subtract start time from Now, and add that duration to a running total duration. Might help to restore the native buttons and see how they set the values in the table when you press each button.

1 Like

Thank you.
I watched how the stopwatch works and I managed to use it almost fully by costume buttons.

I manged to start /stop and pause the stopwatch.

I got stuck only on 1 thing:
I couldnā€™t SUM the DURATION and START after pause.

START is full date (d/m/y/ hh:mm/ss) and duration is just minutes:second (00:40 for example).
How can I calculate it?
Tried both date difference and Math columns and no success.

Thank you.

Thinking about this some more, I think all you need to do is write the start date to a separate column the first time you click on start. Then just use a math column to subtract that new column from Now. That will calculate duration regardless if your stopwatch is paused or not. Only clear and reset that second start time column when you need to start over.

3 Likes

Hi, I tried what you suggested.
I managed to get the PAUSE time and SUM it with the START TIME.

So when I hit the costume pause button, The stopwatch pauses as it should.
Then - > Set col values:
STOPWATCH START TIME: SUM start time(=Pause time+start time).

When I hit the custom resume button, it continues as I did not press the pause.

For example:
A. Costume start button:1. Set col values of current time : 1/25/2024, 4:39:02 PM

  1. Set col values of current time in 2nd col.

B. Then I press the custom pause button: 1. Clear A1
2. Calculate the time A2 to NOW
For example: 00:50 Sec.

C. When I press custom resume button:

  1. Set col value: B2 - > A1
    and the stopwatch begins with 1/25/2024, 4:39:02 PM (Original time) instead of 1/25/2024, 4:41:20 PM (Calculated time = Pause time + A1)

Any solution? Thanks.

When you resume you want to set the current time (now), not the saved time to A1. But you also was to set the duration that was calculated previously to the stopwatch duration column. The start time and duration will always change when you resume from pause. The only value that doesnā€™t change is the saved start time that you set only the first time you clicked on start.

It seems to work! But- only for the first PAUSE/RESUME click.

I press the PAUSE and is pauses, press the RESUME and it resumes from where it pauses.
But then I press pause again - and it restarts the stopwatch.

What do you think?

Iā€™m guessing youā€™ll need some custom actions with conditions on your buttons to set and clear the appropriate values based on whether or not the start time and duration are filled or empty.