Timer

General

images/download/attachments/6044883/timer0.PNG

Component Palette Icon:

images/download/attachments/6044883/Time1.PNG


Description

The timer button is an invisible button that can be used to create repeated events in a window. This is often used for animations or repetitive scripts within a window. When running, the timer's Valueproperty is incremented by the Step By value, until the value tis the Bound, at which point it repeats. It is often useful to bind other values to a timer's Value property.

For instance, if you set the timer's Bound property to 360, and bind an object's rotation to the Value property, the object will spin in a circle when the timer is running.
How fast the timer counts is up to the Delay property, which is the time between counts in milliseconds.

Want to run a script every time the timer counts? First, make sure you don't actually want to write a project Timer Script, which will run on some interval whenever the application is running. In contrast, a script that works via a Timer component will only run while the window that contains the Timer is open, and the Timer is running. The way to do this is to attach an event script to the actionPerformedevent.

Properties

Name

Description

Property Type

Scripting

Category

Bound

The value is always guaranteed to be less than this upper bound.

int

.max

Data

Delay (ms)

The delay in milliseconds between timer events.

int

.delay

Behavior

Initial Delay (ms)

The delay in milliseconds before the first event when running is set to true.

int

.initialDelay

Behavior

Name

The name of this component.

String

.name

Common

Running?

Determines whether or not the timer sends timer events.

boolean

.running

Behavior

Step by

The amount added to the value each time this timer fires for use as a counter. (should be positive)

int

.step

Data

Value

The current value of this timer, for use as a counter.<P>At each iteration, this value will be set to ((value + step) MOD bound)

int

.value

Data

Scripting
Scripting Functions

This component does not have scripting functions associated with it.

Extension Functions

This component does not have extension functions associated with it.

Event Handlers

action

actionPerformed

Fires when the mouse moves over a component after a button has been pushed.

.source

The component that fired this event

propertyChange

propertyChange

Fires whenever a bindable property of the source component changes. This works for standard and custom (dynamic) properties.

.source

The component that fired this event

.newValue

The new value that this property changed to.

.oldValue

The value that this property was before it changed. Note that not all components include an accurate oldValue in their events.

.propertyName

The name of the property that changed. NOTE: remember to always filter out these events for the property that you are looking for! Components often have many properties that change.

Customizers

This component does not have any custom properties.

Examples
Expression Binding Example
//Suppose that you have images that make up frames of animation. 
//Name your images: "Frame0.png", "Frame1.png", "Frame2.png". Set the timer's Bound to be 3, then bind the image path of animate component to the following expression:
"Frame" + {Root Container.Timer.value} + ".png"