Add Outlets and Actions
Using the "+" button below the "Class Outlets" section of the Inspector, add outlets to the ConverterController class. The outlets you need to add are named "amountField", "converter", "dollarField", and "rateField".
We'll connect each of the "field" outlets to one of the text fields in the CurrencyConverter UI, and we'll connect the "converter" outlet to the Converter instance that we created before. When the application launches, it creates the Converter and ConverterController instances and establishes the connections that we specify in the nibfile.
First, though, we need to tell the nibfile about actions as well as outlets. With the "ConverterController" instance selected, use the "+" button below the "Class Actions" section to add a new action. Name the action "convert:":
In this application, the "convert:" action is the only action defined for the user interface, so we are done with actions now. In more complex applications you may need to define many actions and outlets.
Now we'll connect outlets to objects and actions.
InterfaceBuilder enables you to connect objects by Control-dragging from one to another. To Control-drag, you hold down the Control key while dragging from one object to the next.
Select the "ConverterController" instance in the nibfile's main window, and Control-drag a connection to the "Exchange rate" text field in the application's main window. (Be sure to connect to the text field, not to its label!) When you release the mouse button, InterfaceBuilder pops up a menu that lists the available outlets. Choose "rateField" from the menu. The "rateField" outlet of the "ConverterController" instance is now connected to the "Exchange rate" text field.
Repeat the same steps for the "Dollars" field and the "Amount" field, connecting them to the "dollarField" and "amountField" outlets, respectively.
Finally, Control-drag a connection from the "ConverterController" instance to the "Converter" instance. Choose "converter" from the popup menu to connect the "converter" field of the "ConverterController" instance to the "Converter" instance.
To confirm that the connections are correct, you can use the Connections view in the inspector. With the "ConverterController" instance selected, click the blue arrow icon at the top of the Inspector window to display connections. You should see a list of outlets and the types of objects they are connected to:
We need to add one more connection: from the "Convert" button in the application window to the "ConverterController" instance. Control-drag a connection from the "Convert" button in the application window to the "ConverterController" instance in the nibfile's main window. InterfaceBuilder pops up a menu; choose the "convert:" action from the menu to connect the button to the action.
The nibfile now contains descriptions of the needed custom classes and their connections. You can continue with the next section, which explains how to write the Lisp code that implements the application's behavior.