stopwatch
Web icon

Stopwatch

Stable version 1.0.2 (Compatible with OutSystems 11)
Other versions available for 10
Published on 28 May 2019 by 
5.0
 (3 ratings)
stopwatch

Stopwatch

Documentation

Basic usage of Stopwatch

Basically with the stopwatch component you can display a stopwatch in your application, with all the functions a normal stopwatch has like start, pause, resume, stop, reset, and get the current time.

The stopwatch component comes with a webblock that is used to show the time running on the screen, to use it you need to place it inside a container and send the parent container id to the UniqueId input of the webblock (we will refer to it just as UniqueId), you can use several stopwatches on the same page as long as the parent container id is different for each of them. Besides that the other inputs of the webblock are just two options that enable or disable the ability to show the hours and tenths of seconds. The webblock also has an event handler but we will talk more about that later.

Start

The start action receives the UniqueId and the StartTime in milliseconds, this action will start the stopwatch either from 0 or from the start time defined as input. You can use it in any of the screen actions as long as you have the stopwatch webblock on the screen and the action runs after the screen is rendered, this is valid for all the next actions too.

This action works both as start and resume.

Pause

The pause action basically does what it says it pauses the stopwatch, there's not much more to talk about it you basically pass the UniqueId as input and it pauses the stopwatch.

Reset

The reset action receives the UniqueId and resets the stopwatch to zero. The reset action also stops the stopwatch so if what you want is to reset the timer without stopping it you should use the Start action and send a StartTime of 0 milliseconds.

GetTimeAsString

This is the action that will make use of the event handler (OnGetTime) of the stopwatch webblock, this action can seem a bit confuse, because I’m sure you would expect this to return the time as an output, what it actually does is, it gets the time from the screen and returns it with an event, then on the event handler you can get the time from the TimeAsString attribute, have in mind that the time will be returned in a string formatted in the same way that it appears on the screen.