Version 3 (modified by mikel, 6 years ago) (diff)


Enable Tabbing Between Text Fields

Users generally expect to be able to use the Tab key to move from one text field to the next in a dialog box. InterfaceBuilder enables you to specify the tabbing order in text fields.

  1. Choose "Layout" > "Keyboard Navigation" > "Show Keyboard Check". InterfaceBuilder displays a set of small icons that identify UI elements that can respond to key events.
  1. Select the "Exchange Rate" text field (the field, not the label) and then choose "Layout" > "Keyboard Navigation" > "Make Initial First Responder". A small "1" icon appears in the text field to show that when the application launches, that field receives keyboard events.
  1. Control-drag from the "Exchange Rate" field to the "Dollars" field. InterfaceBuilder shows the "Connections" Inspector, and, because Keyboard Check is enabled, automatically selects the "nextKeyView" outlet. Click the "Connect" button in the Inspector window to confirm.
  1. Repeat the previous steps to connect the "Dollars" field back to the "Exchange Rate" field. That way, tabbing moves the insertion point from the "Exchange Rate" field to the "Dollars" field, and then back to the "Exchange Rate" field. Control-drag from the "Dollars" field to the "Exchange Rate" field, then click "Connect" to confirm.

We don't enable tabbing into the "Amount" field because it's not an editable field; it's used only to show the result of a conversion.

At this point the look of the interface and its response to key events is complete. Now we need to define the custom classes that will implement the application behavior. The next section describes how to do that.

Start Previous Next