### Event Example 1: Calling Code on an EventClick Event

This event example uses a Button object. To test this, you will need to use the Form Editor.

1. Select View | Form Editor to access the Form Editor.

2. First, insert a button into your form by clicking on the Button icon on the Object toolbar and then dragging out a rectangle for the button onto the form.

3. Make sure that the button is selected (highlighted).

4. Right-click on the button to bring up the dialog showing the button’s properties.

5. If not expanded, click on the + sign next to the Events section to expand the list. You should see a list of all of the available event handler functions for the button object.

   Example of a Button Object's Events

6. double-click on the EventClick function in the list. A Visual BASIC Editor entitled VBS Mini-Editor opens.

7. Add the following code to the EventClick function inside the VBS Mini Editor:
   MsgBox “I've been clicked.".

8. Click the OK button in the upper right hand corner of the VBS Mini-Editor. Close the Property Sheet.

9. Save the report by selecting File | Save. You are now ready to test the report in Run Mode.

10. Switch to Run Mode (press CTRL + E).

11. Click on the button you created. A message box with the text I’ve been clicked! should appear.

This simple example illustrates the basics of scriptable forms and event handlers.