All controls support several common event handlers. Some controls also support control-specific event handlers (known as 'Custom Events').
For example, all controls support an event for pressing and releasing the left mouse button (OnMouseLeftButtonDown). A button control also supports an OnClick event, while a checkbox supports OnChecked and OnUnchecked events.
Event handlers common to all controls include:
| Event Name | Occurs When |
|---|---|
| OnInitialize | This element is added to the page canvas (also when the hosting page is loaded). You can use this event to add custom initialization. |
| OnTerminate | This element is removed from the page canvas (also when the hosting page is unloaded). You can use this event to add custom clean-up. |
| OnMouseEnter | The mouse pointer enters the bounds of this element. |
| OnMouseLeave | The mouse pointer leaves the bounds of this element. |
| OnMouseMove | The mouse pointer moves while over this element. |
| OnMouseLeftButtonDown | The left mouse button is pressed while the mouse pointer is over this element. |
| OnMouseLeftButtonUp | The left mouse button is released while the mouse pointer is over this element. |
| OnMouseWheel | The user rotates the mouse wheel while the mouse pointer is over this element. |
Element event handlers have access to intrinsic objects: Element, ElementData, Me, EventName and EventArgs.
Element event handlers can be edited using Property Explorer.
For an example of how to use the Element, ElementData, and EventName intrinsic objects, see Script Context.
