core

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

This event example uses a Button object in the Form Editor.

1. Select File | Reporting | New | Form Report to open 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 box that shows the button’s properties.

5. If the list is 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 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.