What Are Events?

From RAD Studio
Jump to: navigation, search

Go Up to Creating events Index

An event is a mechanism that links an occurrence to some code. More specifically, an event is a method pointer that points to a method in a specific class instance.

From the application developer's perspective, an event is just a name related to a system occurrence, such as OnClick, to which specific code can be attached. For example, a push button called Button1 has an OnClick method. By default, when you assign a value to the OnClick event, the Form Designer generates an event handler called Button1Click in the form that contains the button and assigns it to OnClick. When a click event occurs in the button, the button calls the method assigned to OnClick, in this case, Button1Click.

To write an event, you need to understand the following:

Event sequence