Associating an Event with an Existing Event Handler
Go Up to Working with Events and Event Handlers
You can reuse code by writing event handlers that respond to more than one event. For example, many applications provide speed buttons that are equivalent to drop-down menu commands. When a button initiates the same action as a menu command, you can write a single event handler and assign it to both the button's and the menu item's OnClick event.
To associate an event with an existing event handler
- On the form, select the component whose event you want to handle.
- On the Events page of the Object Inspector, select the event to which you want to attach a handler.
- Click the down arrow in the Value column next to the event to open a list of previously written event handlers. (The list includes only event handlers written for events of the same name on the same form.) Select from the list by clicking an event-handler name.
The previous procedure is an easy way to reuse event handlers. Actions, however, provide powerful tools for centrally organizing the code that responds to user commands.