Timer control
The Timer control allows you to repeatedly execute a rule after a period of time. The period and the number of times is configurable. The Timer control can be used for example to keep track of the time spent on a specific Form, i.e. counting the seconds lapsed once the Form is run. It can also be used to refresh a list of values or data on a frequency without user intervention, e.g. shares prices, Twitter feeds, RSS feeds, etc. The Timer control is an action control and will therefore execute a rule action.
The Timer control is not a display control and will not surface at runtime.
- Create a View .
- Drag the Timer control onto the canvas. The control can be found in the Action section of the Controls found in the View Designer, see the Properties section below.
- Configure the Interval and Number of ticks properties in the Properties section.
- Configure the rest of the properties as required.
- Create and configure a rule using the When Timer is Ticked event of the control to execute any rule action as required. The List refresh method can be used for example to get an updated list of data.
- Run the View. The foreign currency list in the example below will be updated according to Interval and Number of Ticks settings configured.
- The Timer control is executed when a View or Form is run.
- A rule action needs to be configured with the When Timer is Ticked event.
Rule events:
- When the Timer is Initializing - execute the rule once when the View/control is loading
- When the Timer is Ticked - execute the rule the amount of times configured in the Number of Ticks property after the amount of milliseconds configured in the Interval property.
Timer control methods:
- execute the Timer control’s Start method - Starts the timer tick event. If a timer is stopped before the lapse of number of ticks, upon start, the tick count will reset to initial count. Without the Start method, the timer will not tick at the specified interval and for the number of ticks specified, for example :
When the View executed Initialize
execute the Timer’s Start method
Then the timer’s Ticked event will begin executing as specified. - execute the Timer control’s Stop method - Stops the timer tick event.
- execute the Timer control’s Tick method - The Tick method will execute whatever rule action is associated with the When the Timer is Ticked event. This can be done without using the Start method, but will only execute the timer’s tick method once per event, for example :
When the Timer is Ticked
show a message
Then
When the Button is clicked
execute the Timer’s Tick method
So on Button click, a message will display but this method will not tick continuously. The User will have to click the Button to execute the Tick method every time.
At runtime, clicking the Button will execute the Ticked event without needing the interval to have passed. Using the execute the Timer control’s Tick method action requires the When the Timer is Ticked event in another rule or nothing will happen at runtime.
The Timer control interacts with other controls through rules. Depending on the control properties, there are certain actions where the control surfaces. Following are a few examples:
- Set a control’s properties- The control's settable properties can be configured using this action
- Enable/Disable - The Enabled property allows for the control to be enabled or disabled through rules
- Data Transfer - Data can be transferred from items listed in the Context Browser to the control
The Timer control is available in the Action section of the Controls found in the View Designer.
Property | Description | Can be set in runtime using Rules |
---|---|---|
Detail | ||
Name | A unique identifier for the selected control. This property is required. | No |
Interval | The time lapsed between executing the When Timer is Ticked event . The interval is measured in milliseconds. Using the Interval and Number of Ticks settings as per the image above, a rule action will be executed 1000 times every 30 seconds. | Yes, see Control Properties Actions for more information |
Number of Ticks | Amount of times the control's When Timer is Ticked event will execute. Using the Interval and Number of Ticks settings as per the image above, a rule action will be executed 1000 times every 30 seconds. | Yes, see Control Properties Actions for more information |
Infinite tick count | Amount of times the control's When Timer is Ticked event will execute. In this instance it will be infinite. If Tick Count Infinite setting is true, the Number of Ticks setting will be ignored. The default for this setting is false. | No |