Version 9 (modified by mikel, 13 years ago) (diff)


Add Text Fields

Next we will add text fields to the application window. Two of the fields are for user input: one accepts the number of dollars to convert to a foreign currency; the other accepts the exchange rate. The third text field is a read-only field that displays the dollar amount converted to the foreign currency.

In InterfaceBuilder's Palettes window, select the "Cocoa Text" view, and find the NSTextView object:

Cocoa Text palette

Drag an NSTextView object and drop it into the "Currency Converter" window:

Dropping the NSTextView

If you drag a view near the edges of a window, InterfaceBuilder? displays blue guide lines that show the standard placement. Drag the text view to the right and upward until the guide lines appear, and then let go. The text view is then positioned in the standard way.

Now add two more text fields. You can drag them from the palette as you did the first one, or you can duplicate the first one. To duplicate, select the first text view and then choose "Duplicate" from the "Edit" menu. Alternatively, you can Option-drag the text field to duplicate it.

Two more NSTextField objects

Start Previous

Attachments (6)

Download all attachments as: .zip