[Contents] [Index] [Next] [Previous]

Selection Actions


Each collection maintains its own selection. A selection need not contain any elements, in which case it is said to be an empty selection. At any time, there is one selection called the primary selection, which is the last selection explicitly started by the user.

Clicking BSelect or BSelect moves the primary selection to a collection only when it results in making a selection that is not empty. When BSelect is clicked, an implementation can move the primary selection to the component even if the resulting selection is empty. Dragging BSelect, BSelect, or BSelect must move the primary selection to the component if a button release during the pointer motion could have potentially selected any element.

A selection is said to be persistent if it is highlighted even when it is not the primary selection.

Persistent
There are two variants of persistent selections: persistent always, in which the current selection is always highlighted, and persistent on focus, in which the current selection is only highlighted when it is the primary selection or when the collection has the keyboard focus. In either case, stronger highlighting should be used when the current selection is also the primary selection. When focus is in the collection, can be used to promote the current selection to the primary selection.
Nonpersistent
The collection only highlights a primary selection. When the primary selection is lost to another collection, the current selection is set to empty. When focus is in the collection, and it does not have the primary selection, can be used to restore the previous selection and make it the primary selection.

Collections that are never editable (such as noneditable Lists) should always use persistent selections. Collections that are editable can use either persistent or non-persistent selections.

When the user makes or changes a selection, the application can display information about the selection, but it should not perform any other action that uses the selected elements. For example, selecting a file from a List of files should not automatically open the file. Such actions should require additional user interaction.

Destination Component

The destination component is used to identify the component on which certain operations, primarily data transfer operations, act. There is only one destination component at a time. When using an explicit focus policy, the destination component must be the editable component that last had focus. When using a pointer focus policy, the destination component must be the editable component that last received mouse button or keyboard input.

Special highlighting should be used to identify the destination component. In Text, a solid insertion cursor can be shown.

Operation Targets

Once a selection is made, the elements of the selection can be acted on using selection actions. Some common selection actions are delete, cut, copy, and paste, although your application is not limited to these. This section and the following one describe the way many selection operations work. Operations that transfer data are described in greater detail in Transfer Models.

The user may invoke an operation that can act on a selection in some component. A keyboard operation can be used, or a control can be activated, which performs the operation. There can be a number of components in a window to which the action could be applied, and it may not be clear which component is the target. This could be the case, for example, when selecting Copy from the Edit Menu, or when typing , the accelerator for Copy. For operations that act on selections, use the following hierarchy of rules to determine which component's selection to act on:

  1. If the keyboard focus is in a component (or a Popup Menu of a component) that supports selections, the action must act on that component.
  2. Otherwise, if the keyboard focus is in a window (or a Menu of a window) with a main component that has a persistent selection, it should act on the main component.
  3. Otherwise, if the keyboard focus is in the window (or a Menu of the window) that has the destination component, and the destination component contains a persistent selection that is not empty, it should act on the destination component.
  4. Otherwise, if the keyboard focus is in the same window (or a Menu of the window) that has the primary selection, it should act on the component with the primary selection.
  5. Otherwise, if the keyboard focus is in a window (or a Menu of a window) that has only one editable component with a persistent selection, then it can act on that component.
  6. Otherwise, invoking the action should have no effect, except to signal an error or post a DialogBox.

Similarly, the user may invoke an operation that transfers data to a component or otherwise uses a component in some way, and, again, it may not be clear which component should be used. This could be the case, for example, when selecting Paste from the Edit Menu, or when typing , the accelerator for Paste. For operations that do not act on selections, use the following hierarchy of rules:

  1. If the keyboard focus is in a component (or a Popup Menu of a component) that supports the action, the action must be applied to that component.
  2. Otherwise, if the keyboard focus is in a window (or a Menu of a window) with a main component that supports the action, it should be applied to the main component.
  3. Otherwise, if the keyboard focus is in the window (or a Menu of the window) that has the destination component, and the destination component supports the action, it should be applied to the destination component.
  4. Otherwise, invoking the action should have no effect, except to signal an error or post a DialogBox.

Selection Operations

This subsection describes some of the standard operations available through the Edit Menu and through standard keyboard bindings that operate on selections.

A collection can either enable or disable pending delete, which controls the circumstances under which the selection is deleted. By default, pending delete should be enabled.

Inserting or pasting elements into a selection, except for a primary transfer operation at the bounds of the primary selection, must first delete the selection if pending delete is enabled.

In normal mode, inserting or pasting elements disjoint from the selection must also deselect the selection, except for primary transfer operations whose source and destination are in the same collection. In add mode, the selection must not be deselected.

In editable list-like and graphics-like collections, must delete the selected elements. In editable text-like collections, and [BackSpace] must behave as follows:

More generally, any operation that deletes a region (for example, a word or line) behaves as follows:

If the region deleted (in add mode) partially overlaps the selection, then the overlapped part of the selection must be deleted.

Generally, whenever an action causes data to be removed from a component, what to do with the space left by the data is up to the component. In cases where the surrounding data can be reformatted to fill in the space left by the removed data (such as in Text components), the delete action should cause this reformatting. In this case, a clear action should delete the data without reformatting any surrounding data. In Text components, the clear action deletes the selected text and replaces it with white space. In cases where the surrounding data cannot be reformatted to fill in the space left by the removed data (such as in bitmap graphics), the delete action should remove the data but not cause any reformatting. The Cut entry from the Edit Menu should behave like the delete action.

In cases where an action adds data to a component, the effect the new data has on the surrounding data depends on the component. In cases where the surrounding data can be reformatted to allow the new data to fit in (such as in Text components), insert actions should cause this reformatting. The Paste entry from the Edit Menu should behave like insert actions.

<Undo> or should undo the last operation on a selection.