Handle Events Through the Wire Manager

Handle Events Tutorial Contents User-Defined Method

First, you create a wire between the objects that affect one another. In this example, when the user types a name and clicks the Submit button, the name displays in the list object. The button affects the list object, so you want to wire these two objects.

  1. Click the wire tool .

  2. With the cursor over the button labeled Submit, press the left-mouse button, drag the cursor over the list object, and release the mouse button.

    The wire displays as follows:


  3. Double-click anywhere on the wire.

    This opens the Wire Manager.

    When the Submit button is clicked, an actionPerformed occurs.

  4. Specify actionPerformed as the triggered event for the Sender object.

    The event triggers the addItem method in the list box.

    Notes:

  5. In the Receiver: nameList, specify addItem as the Input.

    The event tells the addItem method to get its information from the getText( )method of the textfield object.

  6. In the Argument: Event.arg box, specify nameField as the Object and getText( ) as the Method.

  7. Click the Apply Changes button.

    The completed Wire manager should be similar to the following:


  8. Close the Wire Manager.

    Handle Events

    Tutorial Contents

    User-Defined Method

    Guide to the Cosmo Code Development Environment
    12-96*112