Handle Events Through the Wire Manager

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.
-
Click the wire tool
.
-
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:

-
Double-click anywhere on the wire.
This opens the Wire Manager.

When the Submit button is clicked, an actionPerformed occurs.
-
Specify actionPerformed as the triggered event for the Sender
object.
-
In the Sender:submitButton box, click on the arrow to the right of the
Trigger field.
-
Click on actionPerformed.
The event triggers the addItem method in the list box.
Notes:
-
The 1.0.2 JDK Style events are listed in upper case and that the 1.1
JDK Style events are lower case.
-
If you specify 2 wires, one as a 1.02 event and one as a 1.1 event, the
1.02 event is ignored. If both wires are the same style, they are both
used.
-
While you can mix event styles, using only 1.1 style events provides better
performance. The only exception to mixing event styles is if
you use the same kind of event. For example, if you use a 1.1
event and it's deprecated 1.0.2 equivalent, then only the 1.1
event will ever be triggered.
-
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.
-
In the Argument: Event.arg box, specify nameField as the Object
and getText( ) as the Method.
-
Click the Apply Changes button.
The completed Wire manager should be similar to the following:

-
Close the Wire Manager.

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