Connecting Features to Custom Logic

The source for a custom logic connection must either be an event or an attribute with an associated event.

  1. Open the connection menu for the source part.

  2. From this menu, select the event.

  3. Move the mouse pointer to the target part and click mouse button 1. The connection menu opens for the target part.

  4. Select Custom logic. The Custom Logic Connection window appears.

  5. Enter information about the connection in the Description field.

    The Description field serves two purposes. After you complete the connection, if you select the connection line, the text that you entered in this field appears in the information area at the bottom of the Composition Editor.

    When you generate the code for this part, VisualAgeinserts this description in the ITRACE_DEVELOP statement that appears in the dispatchNotificationEvent member function for the connection class. When you run the compiled application with tracing set on, VisualAge write this description to the trace destination whenever the connection code runs.

  6. Enter the appropriate value in the Return type field.

    This field contains the return type for your custom logic. If you want to pass a return value from your custom logic, change the return type from the default void to the type of data that you want to pass.

  7. Add code to the Custom Logic field.

    The Custom Logic field is a multiline entry field, where you enter your custom logic.

    You can specify whether your custom code affects the source or the target part by selecting the appropriate push button before entering a line of code.

    Select the Event push button to insert a reference to the source of the connection (an INotificationEvent). The event reference gives you access to the data that is passed by the event. You might use this to test for specific event data and do processing based on the result of the test.

  8. Select the Add push button and the connection window disappears. VisualAge draws a connection arrow from the source to the target.


Related concepts
Custom Logic Connections

Related procedures
Connecting Features to Other Features
Connecting Features to Member Functions
Opening Connection Settings
Reordering Connections
Selecting and Deselecting Connections
Changing the Source and Target of Connections