Coding event logic

To make the objects in the UI respond to user interaction or system events, you must subscribe to the appropriate events and write methods for them.