This section assumes that you have at least some background with the Visual Basic programming language. If you need to learn Visual Basic, please consult a book or other external resource on the subject.
The Events section on the Properties dialog box contains a list of event handler functions that your template or form object supports. An event handler function will be called whenever the event implied by the name of the function occurs for the given object. When that function gets called, any Visual Basic code inside that function gets executed.
Available Event Handler Functions
EventClick
Called when the mouse is clicked on the object.
EventDblClick
Called when the mouse is double-clicked on the object.
EventDragDrop
Called when another "draggable" item is dropped onto the object.
EventDragEnter
Called when a draggable item is initially dragged onto the object.
EventDragOver
Called when a draggable item is dragged over the object.
EventInitialize
Called when the form first enters into run mode before any other handlers
are called on the object.
EventMouseDown
Called when a mouse button is depressed while over the object. Parameters
passed to the function indicate which button was pressed, if the SHIFT
key was pressed, and the coordinates of the mouse at the moment the mouse
button was depressed.
EventMouseMove
Called when the mouse is passed over the object. Parameters passed to the
function indicate which button was pressed, if the SHIFT key was pressed,
and the coordinates of the mouse when the move event was sent.
EventMouseUp
Called when the mouse button is released over the object. Parameters passed
to the function indicate which button was pressed, if the SHIFT key was
pressed, and the coordinates of the mouse at the moment the mouse button
was released.
EventPumpData
This is perhaps the most widely used handler function in the Form Editor.
EventPumpData
is called whenever BASIC variables that may affect the object change value.
Your code can also force EventPumpData to be called on individual
objects (or on all objects in a report) when you wish an object to update
itself. Basically, any code that an object needs to reinitialize itself
based on variable values or the state of other objects should occur in
EventPumpData.
EventTerminate
Called when the report is being closed or when toggling from run mode to
edit mode in the Form Editor.
This handler function is only available for the Section editing environments.
EventReportData
This is perhaps the most widely used handler function in the Report and
Label Template editors. It gets called whenever report data gets plugged
into the current template.
Its primary function is to let you create your own ActiveX controls that get placed into a label. For example, PC-DMIS's best fit and feature analysis controls use this event to send data to the ActiveX control from the command. To see this, open the label named best_fit_analysis.lbl, click on the ActiveX control inside the label, and then look at the BASIC code inside its event handler. A single line passes data from the command into the control.
With data passed to your own ActiveX control, you can then use automation commands to extract and manipulate the data. See the Pcdbasic help file for information on PC-DMIS automation.
This event gets called once for each command when applying the report template or during measurement routine execution.
Adding Code to Event Handlers
In order to add BASIC language code to any of the event handlers:
Click on the function’s entry from the list of event handlers. A Mini Visual BASIC language editor will appear, with the opening and closing statements of the subroutine already filled in.
Type additional BASIC language statements code into the editor.
Click OK.
Test your code.
If you are using the Form Editor, test your form by pressing Ctrl + E to enter run mode.
If you are using one of the template editors, test your code by applying the template to a report and redrawing the report using the Redraw Report icon from the Reporting toolbar.
Since you don't interact with clickable buttons, lists, fields, or other interactive elements when using a report, the only event handler function available is the EventReportData function.
More:
Event Example 1: Calling Code on an EventClick Event
Event Example 2: Modify Object Properties on Triggered Event