selection (n)
Manipulate the X selection
SYNOPSIS
selection option ?arg arg ...?
DESCRIPTION
This command provides a Tcl interface to the X selection mechanism and
implements the full selection functionality described in the
X Inter-Client Communication Conventions Manual (ICCCM).
The first argument to selection determines the format of the
rest of the arguments and the behavior of the command. The following
forms are currently supported:
selection clear ?-displayof window? ?-selection selection?
If selection exists anywhere on window's display, clear it
so that no window owns the selection anymore. Selection
specifies the X selection that should be cleared, and should be an
atom name such as PRIMARY or CLIPBOARD; see the Inter-Client
Communication Conventions Manual for complete details.
Selection defaults to PRIMARY and window defaults to ``.''.
Returns an empty string.
selection get ?-displayof window? ?-selection selection? ?-type type?
Retrieves the value of selection from window's display and
returns it as a result. Selection defaults to PRIMARY and
window defaults to ``.''.
Type specifies the form in which the selection is to be returned
(the desired ``target'' for conversion, in ICCCM terminology), and
should be an atom name such as STRING or FILE_NAME; see the
Inter-Client Communication Conventions Manual for complete details.
Type defaults to STRING. The selection owner may choose to
return the selection in any of several different representation
formats, such as STRING, ATOM, INTEGER, etc. (this format is different
than the selection type; see the ICCCM for all the confusing details).
If the selection is returned in a non-string format, such as INTEGER
or ATOM, the selection command converts it to string format as a
collection of fields separated by spaces: atoms are converted to their
textual names, and anything else is converted to hexadecimal integers.
selection handle ?-selection selection? ?-type type? ?-format format? window command
Creates a handler for selection requests, such that command will
be executed whenever selection is owned by window and
someone attempts to retrieve it in the form given by type
(e.g. type is specified in the selection get command).
Selection defaults to PRIMARY, type defaults to STRING, and
format defaults to STRING. If command is an empty string
then any existing handler for window, type, and
selection is removed.
When selection is requested, window is the selection owner,
and type is the requested type, command will be executed
as a Tcl command with two additional numbers appended to it
(with space separators).
The two additional numbers
are offset and maxBytes: offset specifies a starting
character position in the selection and maxBytes gives the maximum
number of bytes to retrieve. The command should return a value consisting
of at most maxBytes of the selection, starting at position
offset. For very large selections (larger than maxBytes)
the selection will be retrieved using several invocations of command
with increasing offset values. If command returns a string
whose length is less than maxBytes, the return value is assumed to
include all of the remainder of the selection; if the length of
command's result is equal to maxBytes then
command will be invoked again, until it eventually
returns a result shorter than maxBytes. The value of maxBytes
will always be relatively large (thousands of bytes).
If command returns an error then the selection retrieval is rejected
just as if the selection didn't exist at all.
The format argument specifies the representation that should be
used to transmit the selection to the requester (the second column of
Table 2 of the ICCCM), and defaults to STRING. If format is
STRING, the selection is transmitted as 8-bit ASCII characters (i.e.
just in the form returned by command). If format is
ATOM, then the return value from command is divided into fields
separated by white space; each field is converted to its atom value,
and the 32-bit atom value is transmitted instead of the atom name.
For any other format, the return value from command is
divided into fields separated by white space and each field is
converted to a 32-bit integer; an array of integers is transmitted
to the selection requester.
The format argument is needed only for compatibility with
selection requesters that don't use Tk. If Tk is being
used to retrieve the selection then the value is converted back to
a string at the requesting end, so format is
irrelevant.
selection own ?-displayof window? ?-selection selection?
selection own ?-command command? ?-selection selection? window
The first form of selection own returns the path name of the
window in this application that owns selection on the display
containing window, or an empty string if no window in this
application owns the selection. Selection defaults to PRIMARY and
window defaults to ``.''.
The second form of selection own causes window to become
the new owner of selection on window's display, returning
an empty string as result. The existing owner, if any, is notified
that it has lost the selection.
If command is specified, it is a Tcl script to execute when
some other window claims ownership of the selection away from
window. Selection defaults to PRIMARY.
KEYWORDS
clear, format, handler, ICCCM, own, selection, target, type
'\"
'\" Copyright (c) 1990-1994 The Regents of the University of California.
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: send.n,v 1.2 1998/09/14 18:23:00 stanton Exp $
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\" Start paragraph describing an argument to a library procedure.
'\" type is type of argument (int, etc.), in/out is either "in", "out",
'\" or "in/out" to describe whether procedure reads or modifies arg,
'\" and indent is equivalent to second arg of .IP (shouldn't ever be
'\" needed; use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\" Give maximum sizes of arguments for setting tab stops. Type and
'\" name are examples of largest possible arguments that will be passed
'\" to .AP later. If args are omitted, default tab stops are used.
'\"
'\" .BS
'\" Start box enclosure. From here until next .BE, everything will be
'\" enclosed in one large box.
'\"
'\" .BE
'\" End of box enclosure.
'\"
'\" .CS
'\" Begin code excerpt.
'\"
'\" .CE
'\" End code excerpt.
'\"
'\" .VS ?version? ?br?
'\" Begin vertical sidebar, for use in marking newly-changed parts
'\" of man pages. The first argument is ignored and used for recording
'\" the version when the .VS was added, so that the sidebars can be
'\" found and removed when they reach a certain age. If another argument
'\" is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\" End of vertical sidebar.
'\"
'\" .DS
'\" Begin an indented unfilled display.
'\"
'\" .DE
'\" End of indented unfilled display.
'\"
'\" .SO
'\" Start of list of standard options for a Tk widget. The
'\" options follow on successive lines, in four columns separated
'\" by tabs.
'\"
'\" .SE
'\" End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\" Start of description of a specific option. cmdName gives the
'\" option's name as specified in the class command, dbName gives
'\" the option's name in the option database, and dbClass gives
'\" the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\" Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.2 1998/09/14 18:39:54 stanton Exp $
'\"
'\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
t .wh -1.3i ^B
^l \n(.l
b
'\" # Start an argument description
AP
!"\\$4"" .TP \\$4
\{\
!"\\$2"" .TP \\n()Cu
.TP 15
|
|