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

C H A P T E R 9

User Input

Figure 9-6 Discontinuous selection within an array

 

A

B

C

D

 

1

 

 

 

1. Cells B2, B3, C2 and

2

 

 

 

3

 

 

 

C3 are selected.

 

 

 

4

 

 

 

 

 

 

 

 

5

 

 

 

 

A

B

C

D

 

1

 

 

 

2. The user holds down

2

 

 

 

the Command key and

3

 

 

 

clicks in D5.

4

 

 

 

 

 

 

 

 

5

 

 

 

 

A

B

C

D

 

1

 

 

 

3. The user holds down

2

 

 

 

 

 

 

 

the Command key and

3

 

 

 

clicks in C3.

4

 

 

 

 

5

 

 

 

Not all applications support discontinuous selections, and those that do might restrict the operations a user can perform on them. For example, a word processor might allow the user to choose a font after making a discontinuous selection, but not allow the user to type replacement characters, because it wouldn’t be obvious which part of the selection the characters would replace.

Selections in Text

A block of text is a string of characters. A text selection is a substring of this string, which has any length from zero characters to the whole block.

The insertion point (a zero-length text selection) shows where text will be inserted when the user starts typing, or where the contents of the Clipboard will be pasted. The user establishes the location of the insertion point by clicking somewhere in the text; the insertion point appears at the nearest character boundary. If the user clicks

Selecting

189

Apple Computer, Inc. June 2002

C H A P T E R 9

User Input

anywhere to the right of the last character on a line, the insertion point appears immediately after the last character. If the user clicks to the left of the first character on a line, the insertion point appears immediately before the first character.

Selected text in an active window displays the highlight color chosen by the user in General preferences. When the window becomes inactive, the text should remain highlighted, but in the secondary color, which is a percentage of the original highlight color. When the window becomes active again, the text selection displays in the primary highlight color. Both Carbon and Cocoa contain functions that return the current highlight color, as well as other important colors in the user interface. Your application should use these defined colors in any custom controls you create, rather than hard-coding in specific color values.

Selecting With the Mouse

The user can select a range of text by dragging. A range can consist of characters, words, lines, or paragraphs, as defined by the application.

In text fields, clicking should perform the following actions:

Single-clicking places the insertion point at the pointer’s location in the text.

Double-clicking within a word selects the word. The selection should provide “smart” behavior; if the user deletes the selected word, for example, the space after the word should also be deleted.

Double-clicking in a space selects the space.

Triple-clicking selects the next logical unit, as defined by the application. In a word-processing document, triple-clicking in a word selects the paragraph containing the word. In a table, triple-clicking selects the cell.

What Constitutes a Word

The following definition of a word applies in the United States, Canada, and some other countries. In many countries, the definition differs to reflect local formats for numbers, dates, and currency. Double-clicking a character not in the list below results in the selection of only that character.

190Selecting

Apple Computer, Inc. June 2002

C H A P T E R 9

User Input

A word is defined as any continuous string that contains any of the following characters:

a letter

a digit

a nonbreaking space (Option-space or Command-space)

a currency symbol ($, ¢, £, ¥)

a percent sign

a comma between digits

a period before a digit

an apostrophe between letters or digits

a hyphen, but not Option-hyphen (–) or Option-Shift-hyphen (—)

These are examples of words:

$123,456.78

shouldn’t

3 1/2 (with a nonbreaking space)

.5%

These are examples of strings treated as more than one word:

7/10/6

blue cheese (with a regular space)

“Wow!” (The quotation marks and exclamation point are not part of the word.)

In some contexts—in a programming language, for example—it may be appropriate to allow users to select both the left and right parentheses (or braces or brackets) in a pair, as well as all the characters between them, by double-clicking either one of them. That would mean that a user could select the entire expression

[x+y–(4*3)^(n–1)]

by double-clicking [ or ].

For more information about defining strings as words, see Inside Macintosh: Text.

Selecting

191

Apple Computer, Inc. June 2002

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