next up previous contents index
Next: GTK Text Input Key Up: Text Entry Windows Previous: Single-Line Text Entry   Contents   Index


Selections and Clipboards

Under Unix/Linux, there are two similar data transfer registers: the ``primary selection'', and the ``clipboard''. both correspond to system-wide registers, which can accommodate one data item (usually a text string) each. When text is selected in any window, usually by dragging over the text with button 1 held down, that text is automatically copied into the primary selection register. The primary selection can be ``pasted'' into other windows that are accepting text entry.

The clipboard, on the other hand, is generally set and used only by the GTK text-entry widgets. This includes the single-line entry used in many places, and the multi-line text window used in the text editor (see 3.9), file browser, and some other places including error reporting and info windows. From these windows, there are key bindings that cut (erase) or copy selected text to the clipboard, or paste clipboard text into the window. The cut/paste functions are only available if text in the window is editable, copy is always available.

Under Windows there is a single ``Windows clipboard'' which is a system-wide data-transfer register that can accommodate a single data item (usually a string). This can be used to pass data between windows. In use, the Windows clipboard is somewhat like the Unix/Linux clipboard.

Text in most text display windows can be selected by dragging with button 1 held down, however the selected text is not automatically added to the Windows clipboard. On must initiate a cut or copy operation in the window to actually save the selected text to the Windows clipboard. The ``copy to clipboard'' accelerator Ctrl-c is available from most windows that present highlighted or selected text. Note that there is no indication when text is copied to the clipboard, the selected text in all windows is unaffected, i.e., it won't change color or disappear. The user must remember which text was most recently copied to the Windows clipboard.

Clicking with button 2 will paste the primary selection into the line at the click location, if the window text is editable.

Clicking with button 3 will will bring up a context menu. From the menu, the user can select editing operations.

The GTK interface hides the details of the underlying selection mechanisms, creating a consistent interface under Windows or Uniix/Linux. There is one important difference, however: in Windows, the primary selection applies only to the program containing the selection. In Unix/Linux, the primary selection applies to the entire desktop,


next up previous contents index
Next: GTK Text Input Key Up: Text Entry Windows Previous: Single-Line Text Entry   Contents   Index
Stephen R. Whiteley 2017-02-22