macos:Selecting
出自UXGuide.net
请帮助我们修订和更新本文的中文部分
本文的中文部分虽然取自官方最新中文版本,但与英文原版相比已落后了一年多,可能无法反映英文版本中最近的修改,且文中笔误、前后译法矛盾、未翻译完全的片断较多,请您帮助一起修订完善。详情参见中文版修订完善计划。
选定
Selecting
目录 |
Before performing an operation on an object, the user must select it to distinguish it from other objects. There is always immediate visual feedback to show that something is selected.
在用户对一个对象进行操作之前,用户必须先选定该对象。对于对象的被选定,计算机会立即给出视觉反馈。
Selecting an object never alters the object itself, and a selection is always undoable by clicking outside the selection.
选定一个对象从来不会改变对象本身,而且总是可以通过点击非选定区域来撤销选定。
How something is selected depends on what it is. It’s useful to distinguish among three types of objects that are each dealt with in a different way when selected:
对象被选定的方式依赖于对象的种类。您需要区别三类对象各自不同的选定方式:
- Text. An application considers all text appearing together in a particular context as a block of text—a one-dimensional string of characters. A block of text can range from a single field, as in a dialog, to an entire document, as in a word processor. Regardless of where it appears, text is edited in the same way.
- 文字。 程序总是将所有出现的文字当做一个具体的文字块——一维的字符串数组来考虑。文字块可以是对话框上一个单独的文本框,也可以是字处理程序中整个文档。无论文字块出现的地方,文字都是以同一种方式被编辑。
- Arrays of fields. A one-dimensional array of fields is a list and a two-dimensional array is a table. Each field contains information such as text or graphics.
- 字段。一维的字段就是“表单”,二维的字段就是“表格”。每个字段都包含文字或者图像等对象。
- Graphics. For the purposes of this discussion, a graphic, or picture, is a discrete object that can be selected individually.
- 图像。在本小节的讨论中,一个图像或者图片,都是一个可以被单独选定的离散的对象。
The following sections discuss the general methods of selecting and the specific methods that apply to text, arrays, and graphics.
下面的章节将会讨论选定对象的一些通用的方法以及适应于文字,字段和图像的特定的方法。
选定方法 Selection Methods
This section describes selection techniques.
本小节描述了选定的技巧。
点击选定 Selection by Clicking
The most straightforward method of selecting an object is by clicking it once. Icons, for example, are selected in this way in the Finder.
最直接的选定一个对象的方式就是点击它一次。例如,Finder中图标就是通过这种方式被选定的。
Figure 8-4 Selection of a single item
图 8-4 选定一个单独的对象
拖拽选定 Selection by Dragging
The user can select a range of some objects by following this procedure:
用户可以通过下面的步骤来选定一个范围内的对象:
- The user positions the pointer at one corner of the range and presses the mouse button. This position is called the anchor point of the range.
用户将指针放在选定范围的一个角,并按下鼠标。这个位置叫做选定范围的锚点。 - Without releasing the mouse button, the user moves the pointer in any direction.
不要松开鼠标,用户将指针移到任何位置。
As the pointer moves, visual feedback indicates the objects that would be selected if the mouse button is released. For text and arrays, the selected area is continuously highlighted. For graphics, a dotted rectangle expands or contracts to show the selected area. If appropriate, the view should scroll to allow extending the selection beyond a window.
当指针移动时,会有可视化的反馈来指示鼠标松开时选定对象的范围。对于文字或者字段来说,选定的区域会连续的被高亮。对于图形来说,选定的区域会有虚线的边框或者反色效果。如果可能的话,视图应该可以滚动以让选定区域超过窗口。 - When the desired range is selected, the user releases the mouse button. The point at which the button is released is called the active end of the range.
当需要的范围确定时,用户松开鼠标按钮。松开鼠标的点叫做选定范围的活动点。
Figure 8-5 Selection of a range
图 8-5 范围选定
改变选定区域 Changing a Selection
A user can extend a selection by holding down the Shift key and clicking the mouse button. This action is called Shift-clicking.
用户可以通过按住Shift键并点击鼠标来扩展选定区域。这种操作叫做Shift-点击。
In text, if the user Shift-clicks within an already selected range, the new range is smaller than the old range.
如果用户在一个已经选定的文字范围内Shift-点击,新的选定区域会比原来的更小。
In an array, a Shift-click can extend the selected range or it can move the selection from the current cell to wherever the user Shift-clicks.
用户可以通过Shift-点击来在字段中扩展选定区域,或者将选定区域从当前单元格扩展到用户Shift-点击的地方。
There are two models for extending a continuous selection using Shift-click. In the addition model, new text is added to a current selection. In the fixed-point model, the user can extend the selection on either side of the insertion point. Figure 8-6 illustrates the results of consecutive steps in both models.
Shift-点击来扩展连续的选定区域有两种模式。一种叫附加模式,新的文字会被加入到当前选定区域中。一种叫固定点模式,选定区域只会是从插入点到当前点击点。图8-6阐述了这两个不同模式的区别。
Figure 8-6 Shift-clicking in the addition model and the fixed-point model
图 8-6 附加模式和固定点模式下的Shift-点击
When considering which model to use in your application, keep in mind that the addition model provides more flexibility by allowing users to extend a selection in both directions.
当您考虑在您的程序中支持哪种模式时,请谨记附加模式提供了更多的灵活性,它允许用户在两个方向扩展选择。
A Shift-click should result in a continuous selection—the selection is extended to include everything between the old anchor point and the new active end. A Command-click should result in a discontinuous selection. With discontinuous selection, in which the user can extend a selection by adding nonadjacent objects to already selected objects, the objects between the current selection and the new object are not included in the selection.
Shift-点击会导致连续的选定—选定区域会从旧的锚点一直到新的活动点。Command-点击则会导致非连续的选定。用户可以通过非连续的选定来将零散的对象加到已经选定的对象集合中。在选定的对象和新对象之间 的对象并不会被选定。
Figure 8-7 Discontinuous selection
图 8-7 非连续的选定
In arrays and text in which a Shift-click extends a continuous selection, the user can make discontinuous selections by holding down the Command key and clicking. Each Command-click adds the new object to the existing selection. If one of the objects selected with Command-click is already within an existing part of the selection, then it is removed from the selection instead of being added.
每次Command-点击都会给选定区域增加一个新的对象。如果被点击的对象已经在选定区域了,则Command-点击会将该对象移出选定区域。
Figure 8-8 Discontinuous selection within an array
图 8-8 非连续选定
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.
文字块就是一组字符串,而文字选定区域是这个字符串的子串,长度可以是0,也可以是整个字串的长度。
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 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.
插入点(0长度的文字选定区域)显示了当用户输入时文字会被插入的位置,或者剪切板内容被粘贴的位置。用户可以通过点击文档的任何地方来设置插入点;插入点会显示在离点击位置最近的字符的旁边。如果用户点击一行中最后一个字符的右边任何地方,插入点会立即显示在最后一个字符的后面。如果用户点击在第一个字符的左边,则插入点会立即显示在第一个字符前面。
Selected text in a window is highlighted with the color chosen by the user in Appearance 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. Both Carbon and Cocoa provide a way to 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 specific color values.
在窗口中选定的文字会被高亮,高亮的颜色由用户在外观偏好设置中设定。当窗口变成非活动的时,文字应该保持高亮,但高亮颜色的亮度不及原来亮度。Carbon和Cocoa都提供了函数返回当前高亮的颜色以及其他重要的颜色。您的程序应该在您的定制控件中使用这些定义好的颜色,而不是硬性指定颜色的值。
鼠标选定 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.
- 三次点击会选定语言逻辑单元,由程序定义。在字处理文档中,三次点击会选定包含该单词的整个段落。
- Note that a paragraph usually includes a trailing terminator, such as a Return. Triple-clicking a word in a paragraph highlights the entire paragraph, including all space on the last line that appears between the trailing terminator and the edge of the field or window. This gives the user a visual reminder that the selected text includes a trailing terminator.
单词的构成 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.
下面对单词的定义对美国,加拿大以及一些其他国家都成立。在很多国家,本地化的数字,日期,以及货币格式都会导致不同的定义。在下列表单中的字符上双击只会选择该字符。
A word is defined as any continuous string that contains any of the following characters:
单词被定义为包含下列字符的连续的字符串:
- A letter
字母 - A digit
数字 - A nonbreaking space (Option–Space bar or Command–Space bar)
非断开的空格(Option–空格或者Command–空格) - 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 an en dash (Option–hyphen) or em dash (Shift–Option–hyphen)
连字符,但不包括短破折号(Option–减号)或者长破折号(Shift–Option–减号)
These are examples of words:
下面是一些单词的例子:
- $123,456.78
- shouldn’t
- 3 1/2 (with a nonbreaking space)
- 0.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 by double-clicking [ or ].
在一些上下文中——例如编程语言——可能需要允许用户在左括号和右括号(或者大括号)上双击来选择括号之间的所有字符。这意味着用户可以通过点击[或者]来选择整个表达式:
[x+y–(4*3)^(n–1)]
使用方向键来选择文字 Selecting Text With the Arrow Keys
See “Extending Text Selection With the Shift and Arrow Keys”
请参考 “使用Shift和方向键扩展文字选定区域”。
在电子表格中的选定 Selections in Spreadsheets
To select a single field (cell), the user clicks in it. The user can also select a field by moving to it with the Tab or Return key.
用户单击一个单元格就能选定该单元格。用户也可以通过Tab键或者回车键来选择下一个单元格。
To select part of the contents of a field, the user must first select the field, then click again to select a part.
如果需要选择单元格的内容,用户必须先选定这个单元格,然后再次点击以选择内容。
A user should be able to quickly select a row or column in a table—for example, clicking a column heading should select the column. Tables can also support Command-click for selecting discontinuous fields.
用户应该能够快速的选择表格的一排和一列——例如,点击一个列标题会选择整个列。表格也支持Command-点击来选择离散的单元格。
Pressing the Tab key cycles through the fields in an order determined by your application, and Shift-Tab navigates in the opposite direction. Typically, the sequence is from left to right, then from top to bottom. Pressing Tab from the last field selects the first field.
按下Tab键会以您的程序所定义的顺序遍历单元格,Shift-Tab会以相反的顺序遍历。通常,顺序是从左到右,从上到下。在最后一个单元格上按下Tab键会选择第一个单元格。
If the concept of rows doesn’t make sense in a particular context, the Return key should have the same effect as the Tab key.
如果在特定上下文中行的概念是没有意义的,回车键和Tab键具有同样的效果。
图形的选定 Selections in Graphics
There are several conventions for selecting graphic objects. This section describes two ways to show selection feedback; other situations may require other solutions.
关于图形的选定有很多约定俗成的方式。本小节将会介绍显示选定的两种方式;其他的情况可能会需要不同的解决方案。
An object-based graphics document is a collection of individual graphic objects. To select an object, the user clicks it once. The object is then bracketed with handles, which the user can use to move or resize the object.
基于对象的图形文档是单独的图形对象的集合。用户点击一次则选定了一个对象。这个对象则会被高亮,从而用户可以用来移动和改变大小。
In object-based graphics documents, users can select with the mouse alone or a combination of the mouse and the keyboard. A user can drag a dotted rectangle and select every object that is included, even partially, within the rectangle’s outline. The user can also select an initial object and then use Shift-click or Command-click to select other objects. If the objects have a defined order, Shift-click should result in a continuous selection and Command-click should provide a discontinuous selection. If the order is not defined, then both actions result in a discontinuous selection. Examples of continuous and discontinuous selections are shown in “Selection Methods”
在图形文档中,用户可以单独用鼠标或者鼠标和键盘的组合来选定图形对象。甚至用户也可以用鼠标拖拽出一个虚线的矩形来选择这个矩形内的所有对象。用户也可以开始选定一个对象,然后用Shift-点击或者Command-点击加入其它对象。如果对象已经有定义好的顺序,Shift-点击应该会选定连续的对象,而Command-点击则可以选定离散的对象。如果对象的顺序没有定义,则Shift-点击和Command-点击都只会选定离散的对象。连续选定和非连续选定的例子请参考 “选定方法”一节。
In a bitmap-based graphics document—in which images are a series of pixels rather than discrete objects—a user selects the range of pixels enclosed within a selection tool.
在基于位图——就是图像由一系列的像素而不是具体的对象组成——的图形文档中,用户可以通过选定工具来选定一定范围内的像素。