Official Content

The Chronometer control gives you the possibility to execute an event after a certain time or simply to show a chronometer on the screen. This could be useful in applications like quizzes (for timing the answers), applications that show something on the screen for a while and hide it automatically, among other functionalities.

Warning: As of Android 8.0, Chronometer control could not work properly when it is invisible. Consider set height of control row with 0 dips in order to achieve the same aim.

Using the control

This control can only be applied to Attribute/Variables of numeric type. After dragging the variable to the form, you should set its Control Type property to "Chronometer".

It is valid for both Web and Mobile applications as well.

Web Panels

chronometer control type web example

Panels for Smart Devices or WorkWithDevices

chronometer control type SD example

Properties

Tick Interval   Indicates the frequency in seconds in which the Tick event will be called. 
Max Value The max value that the chronometer can take.
Max Value Text   The text associated with the variable when it reaches its max value.

Methods

Start      Starts the chronometer. It will start from the value (in seconds) of the attribute/variable associated with the control.
Stop      Stops the chronometer.
Reset      Set to 0 the chronometer value.

Events

Tick         This event will be executed every time the value indicated in the tick interval property is elapsed.
Note: The timer needs to be started in order to make the Tick event to execute. When the timer stops, the Tick event will stop its execution.

Example

Event &Var1.Tick
    &count +=1
    if &count = &Somevalue
       //do something
    endif
EndEvent

Event 'Start'
    &Var1 = 55
    &Var1.MaxValue = 60
    &Var1.Start()
EndEvent

Scope

Generators: AndroidAngularAppleJava, .NET, .NET Core

See Also

SD Chronometer Control - Android Sample





Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant