Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Примеры брендбуков / apple_osx-aqua-human-interface.pdf
Скачиваний:
17
Добавлен:
16.02.2016
Размер:
8.01 Mб
Скачать

C H A P T E R 9

User Input

Editing Text

In addition to the methods for selecting text, there are a number of ways to edit text.

Inserting Text

To insert text, the user positions the insertion point by clicking where the text is to go, then starts typing. The application moves the insertion point to the right (or left, depending on the language) as each new character is added.

Applications with multiple-line text blocks should support word wrap, the automatic continuation of text from the end of one line to the beginning of the next without breaking in the middle of a word.

Deleting Text

When the user presses the Delete (or Backspace) key, one of two things happens:

If text is selected, the entire selection is deleted.

If there is no current selection, the character preceding the insertion point is deleted.

In either case, the insertion point replaces the deleted character or characters in the document. The deleted characters don’t go on to the Clipboard, but the user can undo the deletion by immediately choosing Undo from the Edit menu.

You can also implement the keyboard combination Option-Delete (or Option-Backspace) to delete the word that currently contains the insertion point or to delete the part of the word to the left of the insertion point. Be sure to document this behavior if you implement it.

If a keyboard has a Forward Delete (Del) key, the character following the insertion point is deleted each time the user presses the key.

Editing Text

193

Apple Computer, Inc. June 2002

C H A P T E R 9

User Input

Replacing a Selection

If the user starts typing when one or more characters are selected, the typed characters replace the selection. The deleted characters don’t go on to the Clipboard, but the user can undo the replacement by immediately choosing Undo from the Edit menu.

Intelligent Cut and Paste

Intelligent cut and paste is a set of editing features that takes into account the need for spaces between words. To understand why this feature is helpful, consider the following sequence of events in a text application without intelligent cut and paste:

1.A sentence in the user’s document reads

Returns are only accepted if the merchandise is damaged.

The user wants to change this to

Returns are accepted only if the merchandise is damaged.

2.The user selects the word only by double-clicking. The letters are highlighted, but neither adjacent space is selected.

3.The user chooses Cut from the Edit menu, clicks just before the word if, and chooses Paste.

4.The sentence now reads

Returns are accepted onlyif the merchandise is damaged.

To correct the sentence, the user has to remove the extra space between are and accepted, and add a space between only and if.

If your application supports intelligent cut and paste, follow these guidelines:

If the user selects a word or a range of words, the selection itself is highlighted, but spaces adjacent to the selection are not highlighted.

When the user chooses Cut, if the character preceding the selection is a space, cut that space along with the selection. If the character preceding the selection is not a space, but the character following the selection is a space, cut that space along with the selection.

194Editing Text

Apple Computer, Inc. June 2002

C H A P T E R 9

User Input

When the user chooses Paste, if the character to the left or right of the current selection is part of a word (but not inside a word), insert a space before pasting.

Use intelligent cut and paste only if the application supports the definition of a word as described in “What Constitutes a Word” (page 190). These rules apply to any selection consisting of one or more whole words, no matter how the user made the selection.

Note: Intelligent cut and paste doesn’t apply to all languages. Thai, Chinese, and Japanese, for example, don’t contain spaces.

Editing Text Fields

If your application isn’t primarily a text application, but it has text entry fields in dialogs, for example, you may not need to provide the full text-editing features described in this section. The application should, however, be forward-compatible with the full text-editing capabilities. The application should support the following capabilities:

The user can select the whole field and type in a new value, delete text, select a substring of the field and replace it, and select a word by double-clicking.

The user can choose Undo, Cut, Copy, Paste, and Delete, as described in “The Edit Menu” (page 59).

Your application can also support intelligent cut and paste.

Even applications with only minimal text editing should perform appropriate edit checks. For example, if the only legitimate value for a field is a string of digits, the application should alert the user if any nondigits are typed. For a more complete discussion of when to check for errors and apply changes in text fields, see “Accepting Changes” (page 101).

Editing Text

195

Apple Computer, Inc. June 2002

C H A P T E R 9

User Input

Entering Passwords

When a user types a password into a text field, each typed character should appear as a bullet, matching the number of characters typed by the user. If the user deletes a character with the Delete key, one bullet is deleted from the text field and the insertion point moves back one bullet, as if the bullet represented an actual character. Double-clicking bulleted text in a password field selects all the bullets in the text field.

When the user leaves the text field (by pressing Tab, for example), the number of bullets in the text field should be modified so that the field does not reflect the actual number of characters in the password.

196Editing Text

Apple Computer, Inc. June 2002

Соседние файлы в папке Примеры брендбуков