Component Events
Event Handlers
When running scripts on a component, we typically don't want it to be constantly running, but instead want the script to trigger when the user does something on screen such as clicks with the mouse. That something the user does is called an Event and can range from a simple mouse click, keypress to a window opening, or a component property change. When certain events happen, they trigger Event Handlers, which use a script to handle what happens when the event occurs.
This page lists out all of the event handlers that are on Ignition's standard modules. Any third party modules may add new components which may potentially have new event handlers.
Event Object
Every Event Handler contains an event object, which allows you to interact with the component and the entire window hierarchy within your script. While each event object has different properties depending on what Event Handler it resides in, each event object contains a source property, which is a reference to the component that fired the event. Using event.source not only gives us access to all of the properties available on that particular component, such as the text property of a text field,
# Here we start with the event object, then use source to go to the component that fired the event,
# and then use the name of the property to access its value. In this case, we accessed the text property.
text = event.source.text
but it also provides us with a way to navigate to other components within the hierarchy. For example, here we have a script on a button that references a text field.
# Here again we start with event.source to get to the component that fired the event, but now we use
# parent to go up to the root container, and then getComponent to navigate back down to a different component.
text = event.source.parent.getComponent("Text Field")
Even when components are disabled, most scripting events can still occur. For example, a mouse click can still happen on a disabled component, which is why we recommend using the action performed event when placing a script on a button.
Action Event Handlers
The Action category of event handlers pertains to components being "used" from the client, such as a button being pressed or a checkbox component being selected.

Events
| Events | Description |
|---|---|
| actionPerformed | This event is fired when the 'action' of the component occurs. What this action is depends on the type of the component. Most commonly, this is used with buttons, where the action is that the button was pushed, via a mouse click or a key press. See the component reference for details on what the action means for other components.It is recommended to use this event over mouseClicked whenever possible. |
Event Object Properties
| Properties | Description |
|---|---|
| source | The component that fired this event. |
# On the actionPerformed of a button, this will print Hello World! to the console each time the button is pressed.
print "Hello World!"
Property Event Handlers
Property event handlers typically trigger based on the property of a component.
Events
| Events | Description |
|---|---|
| propertyChange | Fires whenever a bindable property of the source component changes. This works for standard and custom (dynamic) properties. |
Event Object Properties
| Properties | Description |
|---|---|
| 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. |
# On the propertyChange of a component, this script will print out the name of the property that is changing.
print event.propertyName
# It is common to use propertyName to look for specific properties to change. This is a great way to restrict how often your scripts execute
if event.propertyName == 'text':
print 'The Text property changed'
Mouse Event Handlers
The mouse events all correspond to the clicking and movement of the mouse. They are triggered in the client by an operator interacting with a mouse. Touchscreen monitors will trigger these events when a user touches the screen, but not all touchscreens will fire the mouseEntered and mouseExited events.
Events
| Events | Description |
|---|---|
| mouseClicked | This event signifies a mouse click on the source component. A mouse click the combination of a mouse press and a mouse release, both of which must have occurred over the source component. Note that this event fires after the pressed and released events have fired. |
| mouseEntered | This event fires when the mouse enters the space over the source component. |
| mouseExited | This event fires when the mouse leaves the space over the source component. |
| mousePressed | This event fires when the mouse presses down on the source component. |
| mouseReleased | This event fires when a mouse button is released, if that mouse button's press happened over this component. |
Event Object Properties
| Properties | Description |
|---|---|
| source | The component that fired this event. |
| button | The code for the button that caused this event to fire. Use the constants event.BUTTON1, event.BUTTON2, and event.BUTTON3. |
| clickCount | The number of mouse clicks associated with this event. |
| x | The x-coordinate (with respect to the source component) of this mouse event. |
| y | The y-coordinate (with respect to the source component) of this mouse event. |
| popupTrigger | Returns True (1) if this mouse event is a popup trigger. What constitutes a popup trigger is operating system dependent, which is why this abstraction exists. |
| altDown | True (1) if the Alt key was held down during this event, false (0) otherwise. |
| controlDown | True (1) if the Control key was held down during this event, false (0) otherwise. |
| shiftDown | True (1) if the Shift key was held down during this event, false (0) otherwise. |
# On the mouseEntered event of a component, this script will only fire if the mouse enters the bounds of the component.
print "The mouse is inside the component space!"
MouseMotion Event Handlers
The mouseMotion events deal with the motion of the mouse over a component. Not all touchscreen monitors will fire these events.
mouseMotion events will not trigger when the project is viewed from a mobile project as these gestures are used by the browser/device to zoom or pan.
Events
| Events | Description |
|---|---|
| mouseDragged | Fires when a mouse button is clicked on a component and held, and the pointer is then dragged around. |
| mouseMoved | Fires when the mouse moves over a component, but no buttons are being held. |
Event Object Properties
| Properties | Description |
|---|---|
| source | The component that fired this event. |
| button | The code for the button that caused this event to fire. Use the constants event.BUTTON1, event.BUTTON2, and event.BUTTON3. |
| clickCount | The number of mouse clicks associated with this event. |
| x | The x-coordinate (with respect to the source component) of this mouse event. |
| y | The y-coordinate (with respect to the source component) of this mouse event. |
| popupTrigger | Returns True (1) if this mouse event is a popup trigger. What constitutes a popup trigger is operating system dependent, which is why this abstraction exists. |
| altDown | True (1) if the Alt key was held down during this event, false (0) otherwise. |
| controlDown | True (1) if the Control key was held down during this event, false (0) otherwise. |
| shiftDown | True (1) if the Shift key was held down during this event, false (0) otherwise. |
# From the mouseMotion event on a component, this will print each time the mouse moves when it is over the component.
print "The mouse is moving over the component!"
Key Event Handlers
The key events all have to do with the user pressing a key on the keyboard.
