In Delphi, you can set a component’s default event handler using the Object Inspector or in code. For example, to set a button’s OnClick event handler in code: