![]() |
![]() |
![]() |
Use the Event-to-Code Connection window to create a connection that calls code whenever a specified event occurs.
Fields
Push buttons
To complete the connection and close the window, select OK.
To specify parameter values that are constant, select Set parameters.
To close the window without completing the connection, select Cancel.
The Method class field lists the class being edited and all its superclasses. By selecting one of the superclasses, you connect your code to code contained in the superclass. The Method class field updates according to the class selected.
From the Event list, select the event you want to use. The list of events available depends on the bean you selected.
This field provides a drop-down list that contains a placeholder name for new methods and the names of methods you previously created. If you select <new method> and create a new method, VisualAge assigns a default method name by combining the bean name with the event type. For example, if you create an Event-to-Code Connection with button1 as the source and actionPerformed as the event with no event data passed, VisualAge assigns the name button1_ActionPerformed to the new method. You can make the method more descriptive and easier to recognize by changing its name.
Note: | The connection name in the beans list is connEtoC1. |
The method code pane is the large pane located below the event and method fields. Enter your method code in this editable pane. You can also change the name, return value, or parameters of the method by editing the method code. The code pane pop-up menu provides options to assist in editing your code.
If you want the event to pass its parameters to the new method, check Pass event data at the bottom of the panel.
The Pass event data check box indicates whether connection code will pass data, which is sent in the event notification, to the target as input. The specific nature of the data varies by type of event.
This setting affects the visual cues that VisualAge uses to indicate incomplete connections. Since event data is the first parameter value passed, if the target method or code requires only one parameter and Pass event data is checked, the connection appears complete. If the target method or code requires more than one parameter, the connection continues to appear incomplete.
If this box is not checked and inputs are required, VisualAge does not attempt to pass event data to the target, and the connection appears incomplete.
If an event has more than one data parameter and is not specified in another order, the data is passed to the target's parameter in order.
If the event and method parameters match in type, VisualAge defaults to Pass event data. If the event does not have or does not accept parameters, the default is to not pass event data.
Code Connections
Connections
Connecting Features to Code
Supplying a Parameter Value Using a Constant
Connection Windows
Property-to-Property Connection Window
Event-to-Method Connection Window
Constant Parameter Value Properties Window
Parameter-from-Code Connection Window