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 NameOccurs When
OnInitializeThis element is added to the page canvas (also when the hosting page is loaded). You can use this event to add custom initialization.
OnTerminateThis element is removed from the page canvas (also when the hosting page is unloaded). You can use this event to add custom clean-up.
OnMouseEnterThe mouse pointer enters the bounds of this element.
OnMouseLeaveThe mouse pointer leaves the bounds of this element.
OnMouseMoveThe mouse pointer moves while over this element.
OnMouseLeftButtonDownThe left mouse button is pressed while the mouse pointer is over this element.
OnMouseLeftButtonUpThe left mouse button is released while the mouse pointer is over this element.
OnMouseWheelThe 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.