head	1.16;
access;
symbols
	core-8-5-9:1.12
	core-8-5-8:1.12
	macosx-cocoa-merge:1.15
	macosx-cocoa-premerge:1.15
	macosx-carbon-freeze:1.15
	core-8-5-7:1.12
	core-8-5-6:1.12
	core-8-6-b1:1.15
	core-8-6-a3:1.14
	core-8-5-5:1.12
	core-8-6-a2:1.13
	core-8-5-4:1.12
	core-8-5-3:1.12
	core-8-6-a1:1.12
	core-8-4-19:1.4.4.1
	core-8-5-branch:1.12.0.2
	core-8-5-2:1.12
	core-8-4-18:1.4.4.1
	core-8-5-1:1.12
	core-8-4-17:1.4.4.1
	core-8-5-0:1.12
	core-8-5-b3:1.11
	core-8-5-b2:1.9
	core-8-4-16:1.4.4.1
	core-8-5-b1:1.7
	core-stablilizer-merge:1.7
	core-stabilizer-branch:1.7.0.2
	core-stabilizer-merge:1.12
	core-8-4-15:1.4.4.1
	core-8-5-a6:1.7
	core-8-5-a5:1.7
	core-8-4-14:1.4.4.1
	core-8-5-a4:1.7
	core-8-4-13:1.4.4.1
	core-8-4-12:1.4.4.1
	core-8-4-11:1.4.4.1
	core-8-5-a3:1.7
	core-8-4-10:1.4.4.1
	core-8-4-9-branch:1.4.4.1.0.2
	core-8-5-a2:1.6
	core-8-4-9:1.4.4.1
	core-8-4-8:1.4.4.1
	core-8-4-7:1.4
	core-8-5-a1:1.4
	core-8-4-6:1.4
	core-8-4-5:1.4
	mistachkin-dev-branch:1.4.0.6
	core-8-4-4:1.4
	core-8-4-3:1.4
	core-8-4-branch:1.4.0.4
	core-8-4-2:1.4
	core-8-4-1:1.4
	core-8-3-5:1.3
	core-8-4-0:1.4
	macosx-8-4-merge-2002-08-31-trunk:1.4
	macosx-8-4-premerge-2002-08-31-branch:1.4
	macosx-8-4-premerge-2002-08-31-trunk:1.4
	macosx-8-4-merge-2002-08-30-branch:1.4
	macosx-8-4-merge-2002-08-30-trunk:1.4
	macosx-8-4-merge-2002-08-20-branch:1.4
	macosx-8-4-merge-2002-08-20-trunk:1.4
	core-8-4-b2:1.4
	core-8-4-b1:1.4
	macosx-premerge-6-9-02:1.4
	core-8-4-a4:1.4
	core-8-3-4:1.3
	macosx-8-4-branch:1.4.0.2
	macosx-8-4-branchpoint:1.4
	core-8-4-a3:1.4
	core-8-3-3:1.3
	dgp-privates-into-namespace:1.3.0.14
	tclpro-1-5-0:1.3
	core-8-4-win-speedup:1.3.0.12
	core-8-4-a2:1.3
	tclpro-1-4-1:1.3
	tclpro-1-4-0:1.3
	core-8-3-2:1.3
	ajuba-ajuba2-2-1-base:1.3
	ajuba-ajuba2-2-0:1.3
	core-8-4-a1:1.3
	core-8-3-1-branch:1.3.0.10
	core-8-3-1:1.3
	scriptics-sc-2-0-b5:1.3
	scriptics-sc-2-0-fixed:1.3
	scriptics-sc-2-0-b2:1.3
	scriptics-sc-2-0-b1:1.3
	core-8-3-0:1.3
	core-8-3-b2:1.3
	core-8-3-b1:1.3
	scriptics-sc-1-1:1.3
	scriptics-sc-1-1-b1:1.3
	core-8-2-3:1.3
	scriptics-sc-1-1-branch:1.3.0.8
	scriptics-sc-1-1-base:1.3
	scriptics-sc-1-0:1.3
	scriptics-sc-1-0-branch:1.3.0.6
	scriptics-sc-1-0-base:1.3
	core-8-2-2:1.3
	core-8-2-1:1.3
	scriptics-bc-1-0-b1:1.3
	core-8-2-1-branch:1.3.0.4
	scriptics-tclpro-1-3-0:1.3
	core-8-2-0:1.3
	core-8-2-b3-branch:1.3.0.2
	core-8-2-b3-base:1.3
	scriptics-tclpro-1-3-b4:1.3
	core-8-2-b2:1.3
	scriptics-tclpro-1-3-b3:1.3
	core-8-2-b1:1.3
	scriptics-tclpro-1-3-b2:1.2
	merge-to-mainline-5/21/99:1.2
	scriptics-tclpro-1-3-b2-branch:1.2.0.8
	core-8-1-1:1.2
	scriptics-tclpro-1-3-b1:1.2
	core-8-1-1-base:1.2
	core-8-1-0:1.2
	merge-to-mainline-4-29-99:1.2
	merge-to-mainline-4-23-99:1.2
	core-8-1-branch-old:1.1.0.4
	core-8-0-6-branch:1.2.0.6
	core-8-0-6-base:1.2
	core-8-0-5:1.2
	core-8-1-b3:1.1.4.1
	core-8-1-b2:1.1.4.1
	dev-8-1-stubs-branch:1.1.4.1.0.2
	dev-stubs-branch:1.2.0.4
	scriptics-tclpro-1-2:1.2
	scriptics-tclpro-1-2-b2:1.2
	core-8-1-merge-2/10/99:1.2
	core-8-0-5-branch:1.2.0.2
	core-8-0-5-base:1.2
	scriptics-tclpro-1-2-b1:1.2
	scriptics-tclpro-1-2-a1:1.2
	core-8-1-b1:1.1.4.1
	core-8-0-4:1.2
	core-8-1-a2:1.1
	core-8-0-2:1.1
	core-8-0-3:1.2;
locks; strict;
comment	@# @;


1.16
date	2010.01.13.16.16.30;	author dkf;	state Exp;
branches;
next	1.15;

1.15
date	2008.12.17.22.36.46;	author dkf;	state Exp;
branches;
next	1.14;

1.14
date	2008.09.23.13.36.54;	author dkf;	state Exp;
branches;
next	1.13;

1.13
date	2008.06.30.22.57.03;	author dkf;	state Exp;
branches;
next	1.12;

1.12
date	2007.12.13.15.23.43;	author dgp;	state Exp;
branches;
next	1.11;

1.11
date	2007.10.30.15.20.21;	author dkf;	state Exp;
branches;
next	1.10;

1.10
date	2007.10.29.16.04.14;	author dkf;	state Exp;
branches;
next	1.9;

1.9
date	2007.10.26.20.13.23;	author dgp;	state Exp;
branches;
next	1.8;

1.8
date	2007.10.24.14.32.59;	author dkf;	state Exp;
branches;
next	1.7;

1.7
date	2005.04.06.21.11.54;	author dkf;	state Exp;
branches
	1.7.2.1;
next	1.6;

1.6
date	2004.10.28.12.25.53;	author dkf;	state Exp;
branches;
next	1.5;

1.5
date	2004.06.21.21.51.20;	author dkf;	state Exp;
branches;
next	1.4;

1.4
date	2001.06.04.03.15.20;	author hobbs;	state Exp;
branches
	1.4.4.1;
next	1.3;

1.3
date	99.06.03.18.50.45;	author stanton;	state Exp;
branches
	1.3.12.1
	1.3.14.1;
next	1.2;

1.2
date	98.09.14.18.22.59;	author stanton;	state Exp;
branches;
next	1.1;

1.1
date	98.04.01.09.39.56;	author rjohnson;	state Exp;
branches
	1.1.4.1;
next	;

1.1.4.1
date	98.09.30.02.16.29;	author stanton;	state Exp;
branches;
next	;

1.3.12.1
date	2002.04.02.20.57.53;	author hobbs;	state Exp;
branches;
next	;

1.3.14.1
date	2001.07.03.20.01.07;	author dgp;	state Exp;
branches;
next	;

1.4.4.1
date	2004.10.28.12.25.22;	author dkf;	state Exp;
branches;
next	;

1.7.2.1
date	2007.11.01.16.37.16;	author dgp;	state Exp;
branches;
next	;


desc
@@


1.16
log
@Embolden literals
@
text
@'\"
'\" 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: selection.n,v 1.15 2008/12/17 22:36:46 dkf Exp $
'\" 
.so man.macros
.TH selection n 8.1 Tk "Tk Built-In Commands"
.BS
'\" Note:  do not modify the .SH NAME line immediately below!
.SH NAME
selection \- Manipulate the X selection
.SH SYNOPSIS
\fBselection \fIoption\fR ?\fIarg arg ...\fR?
.BE
.SH DESCRIPTION
.PP
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).
.PP
Note that for management of the \fBCLIPBOARD\fR selection (see below), the
\fBclipboard\fR command may also be used.
.PP
The first argument to \fBselection\fR determines the format of the
rest of the arguments and the behavior of the command.  The following
forms are currently supported:
.TP
\fBselection clear\fR ?\fB\-displayof\fR \fIwindow\fR? ?\fB\-selection\fR \fIselection\fR?
.
If \fIselection\fR exists anywhere on \fIwindow\fR's display, clear it
so that no window owns the selection anymore.  \fISelection\fR
specifies the X selection that should be cleared, and should be an
atom name such as \fBPRIMARY\fR or \fBCLIPBOARD\fR; see the Inter-Client
Communication Conventions Manual for complete details.
\fISelection\fR defaults to \fBPRIMARY\fR and \fIwindow\fR defaults to
.QW . .
Returns an empty string. 
.TP
\fBselection get\fR ?\fB\-displayof\fR \fIwindow\fR? ?\fB\-selection\fR \fIselection\fR? ?\fB\-type\fR \fItype\fR?
.
Retrieves the value of \fIselection\fR from \fIwindow\fR's display and
returns it as a result.  \fISelection\fR defaults to \fBPRIMARY\fR and
\fIwindow\fR defaults to
.QW . .
\fIType\fR specifies the form in which the selection is to be returned
(the desired
.QW target
for conversion, in ICCCM terminology), and
should be an atom name such as \fBSTRING\fR or \fBFILE_NAME\fR; see the
Inter-Client Communication Conventions Manual for complete details.
\fIType\fR defaults to \fBSTRING\fR.  The selection owner may choose to
return the selection in any of several different representation
formats, such as \fBSTRING\fR, \fBUTF8_STRING\fR, \fBATOM\fR,
\fBINTEGER\fR, 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 \fBINTEGER\fR
or \fBATOM\fR, the \fBselection\fR 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.
Note that \fBselection get\fR does not retrieve the selection in the
\fBUTF8_STRING\fR format unless told to.
.TP
\fBselection handle\fR ?\fB\-selection\fR \fIs\fR? ?\fB\-type\fR \fIt\fR? ?\fB\-format\fR \fIf\fR? \fIwindow command\fR
.
Creates a handler for selection requests, such that \fIcommand\fR will
be executed whenever selection \fIs\fR is owned by \fIwindow\fR and
someone attempts to retrieve it in the form given by type \fIt\fR
(e.g. \fIt\fR is specified in the \fBselection get\fR command).
\fIS\fR defaults to \fBPRIMARY\fR, \fIt\fR defaults to \fBSTRING\fR, and
\fIf\fR defaults to \fBSTRING\fR.  If \fIcommand\fR is an empty string
then any existing handler for \fIwindow\fR, \fIt\fR, and
\fIs\fR is removed.
Note that when the selection is handled as type \fBSTRING\fR it is also
automatically handled as type \fBUTF8_STRING\fR as well.
.RS
.PP
When \fIselection\fR is requested, \fIwindow\fR is the selection owner,
and \fItype\fR is the requested type, \fIcommand\fR will be executed
as a Tcl command with two additional numbers appended to it
(with space separators).  
The two additional numbers
are \fIoffset\fR and \fImaxChars\fR:  \fIoffset\fR specifies a starting
character position in the selection and \fImaxChars\fR gives the maximum
number of characters to retrieve.  The command should return a value consisting
of at most \fImaxChars\fR of the selection, starting at position
\fIoffset\fR.  For very large selections (larger than \fImaxChars\fR)
the selection will be retrieved using several invocations of \fIcommand\fR
with increasing \fIoffset\fR values.  If \fIcommand\fR returns a string
whose length is less than \fImaxChars\fR, the return value is assumed to
include all of the remainder of the selection;  if the length of
\fIcommand\fR's result is equal to \fImaxChars\fR then
\fIcommand\fR will be invoked again, until it eventually
returns a result shorter than \fImaxChars\fR.  The value of \fImaxChars\fR
will always be relatively large (thousands of characters).
.PP
If \fIcommand\fR returns an error then the selection retrieval is rejected
just as if the selection did not exist at all.
.PP
The \fIformat\fR 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 \fBSTRING\fR.  If \fIformat\fR is
\fBSTRING\fR, the selection is transmitted as 8-bit ASCII characters (i.e.
just in the form returned by \fIcommand\fR, in the system \fBencoding\fR;
the \fBUTF8_STRING\fR format always uses UTF-8 as its encoding).
If \fIformat\fR is
\fBATOM\fR, then the return value from \fIcommand\fR 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 \fIformat\fR, the return value from \fIcommand\fR 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.
.PP
The \fIformat\fR argument is needed only for compatibility with
selection requesters that do not 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 \fIformat\fR is
irrelevant.
.RE
.TP
\fBselection own\fR ?\fB\-displayof\fR \fIwindow\fR? ?\fB\-selection\fR \fIselection\fR?
.TP
\fBselection own\fR ?\fB\-command\fR \fIcommand\fR? ?\fB\-selection\fR \fIselection\fR? \fIwindow\fR
.
The first form of \fBselection own\fR returns the path name of the
window in this application that owns \fIselection\fR on the display
containing \fIwindow\fR, or an empty string if no window in this
application owns the selection.  \fISelection\fR defaults to \fBPRIMARY\fR and
\fIwindow\fR defaults to
.QW . .
.RS
.PP
The second form of \fBselection own\fR causes \fIwindow\fR to become
the new owner of \fIselection\fR on \fIwindow\fR's display, returning
an empty string as result. The existing owner, if any, is notified
that it has lost the selection.
If \fIcommand\fR is specified, it is a Tcl script to execute when
some other window claims ownership of the selection away from
\fIwindow\fR.  \fISelection\fR defaults to PRIMARY.
.RE
.SH EXAMPLES
.PP
On X11 platforms, one of the standard selections available is the
\fBSECONDARY\fR selection. Hardly anything uses it, but here is how to read
it using Tk:
.PP
.CS
set selContents [\fBselection get\fR \-selection SECONDARY]
.CE
.PP
Many different types of data may be available for a selection; the
special type \fBTARGETS\fR allows you to get a list of available types:
.PP
.CS
foreach type [\fBselection get\fR \-type TARGETS] {
   puts "Selection PRIMARY supports type $type"
}
.CE
.PP
To claim the selection, you must first set up a handler to supply the
data for the selection. Then you have to claim the selection...
.CS
# Set up the data handler ready for incoming requests
set foo "This is a string with some data in it... blah blah"
\fBselection handle\fR \-selection SECONDARY . getData
proc getData {offset maxChars} {
   puts "Retrieving selection starting at $offset"
   return [string range $::foo $offset [expr {$offset+$maxChars-1}]]
}

# Now we grab the selection itself
puts "Claiming selection"
\fBselection own\fR \-command lost \-selection SECONDARY .
proc lost {} {
   puts "Lost selection"
}
.CE
.SH "SEE ALSO"
clipboard(n)
.SH KEYWORDS
clear, format, handler, ICCCM, own, selection, target, type
'\" Local Variables:
'\" mode: nroff
'\" End:
@


1.15
log
@Small doc fixes
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: selection.n,v 1.14 2008/09/23 13:36:54 dkf Exp $
d25 1
a25 1
Note that for management of the CLIPBOARD selection (see below), the
a30 1
.PP
d33 1
d37 1
a37 1
atom name such as PRIMARY or CLIPBOARD; see the Inter-Client
d39 1
a39 1
\fISelection\fR defaults to PRIMARY and \fIwindow\fR defaults to
d44 1
d46 1
a46 1
returns it as a result.  \fISelection\fR defaults to PRIMARY and
d53 1
a53 1
should be an atom name such as STRING or FILE_NAME; see the
d55 1
a55 1
\fIType\fR defaults to STRING.  The selection owner may choose to
d57 2
a58 2
formats, such as STRING, UTF8_STRING, ATOM, INTEGER, etc. (this format
is different
d60 2
a61 2
If the selection is returned in a non-string format, such as INTEGER
or ATOM, the \fBselection\fR command converts it to string format as a
d65 1
a65 1
UTF8_STRING format unless told to.
d68 1
d73 2
a74 2
\fIS\fR defaults to PRIMARY, \fIt\fR defaults to STRING, and
\fIf\fR defaults to STRING.  If \fIcommand\fR is an empty string
d77 2
a78 2
Note that when the selection is handled as type STRING it is also
automatically handled as type UTF8_STRING as well.
d105 2
a106 2
Table 2 of the ICCCM), and defaults to STRING.  If \fIformat\fR is
STRING, the selection is transmitted as 8-bit ASCII characters (i.e.
d108 1
a108 1
the UTF8_STRING format always uses UTF-8 as its encoding).
d110 1
a110 1
ATOM, then the return value from \fIcommand\fR is divided into fields
d128 1
d132 1
a132 1
application owns the selection.  \fISelection\fR defaults to PRIMARY and
d148 1
a148 1
SECONDARY selection. Hardly anything uses it, but here is how to read
d150 1
d156 2
a157 1
special type TARGETS allows you to get a list of available types:
@


1.14
log
@Fix [Bug 2118116]
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: selection.n,v 1.13 2008/06/30 22:57:03 dkf Exp $
d132 1
d141 1
d160 1
a160 1
data for the selection.  Then you have to claim the selection...
d167 1
a167 1
   return [string range $::foo $offset [expr {$offset+$maxChars}]]
@


1.13
log
@Minor doc updates (removing out of date changebars, improving typedef formatting,
 etc.)
@
text
@a0 1
'\" -*- nroff -*-
d8 1
a8 1
'\" RCS: @@(#) $Id: selection.n,v 1.12 2007/12/13 15:23:43 dgp Exp $
d179 3
@


1.12
log
@merge stable branch onto HEAD
@
text
@d1 1
d9 1
a9 1
'\" RCS: @@(#) $Id: selection.n,v 1.7.2.1 2007/11/01 16:37:16 dgp Exp $
a19 1

d142 1
@


1.11
log
@Clarify UTF8_STRING handling. [Bug 1778563]
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: selection.n,v 1.10 2007/10/29 16:04:14 dkf Exp $
@


1.10
log
@Lots more GOOBE stuff. Now works with 'make html'!
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: selection.n,v 1.9 2007/10/26 20:13:23 dgp Exp $
d57 2
a58 1
formats, such as STRING, ATOM, INTEGER, etc. (this format is different
d64 2
d67 1
a67 1
\fBselection handle\fR ?\fB\-selection\fR \fIselection\fR? ?\fB\-type\fR \fItype\fR? ?\fB\-format\fR \fIformat\fR? \fIwindow command\fR
d69 9
a77 7
be executed whenever \fIselection\fR is owned by \fIwindow\fR and
someone attempts to retrieve it in the form given by \fItype\fR
(e.g. \fItype\fR is specified in the \fBselection get\fR command).
\fISelection\fR defaults to PRIMARY, \fItype\fR defaults to STRING, and
\fIformat\fR defaults to STRING.  If \fIcommand\fR is an empty string
then any existing handler for \fIwindow\fR, \fItype\fR, and
\fIselection\fR is removed.
d106 3
a108 1
just in the form returned by \fIcommand\fR).  If \fIformat\fR is
a174 1

a176 1

@


1.9
log
@        * doc/*.1:              Revert doc changes that broke
        * doc/*.3:              `make html` so we can get the release
        * doc/*.n:              out the door.
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: selection.n,v 1.7 2005/04/06 21:11:54 dkf Exp $
d40 2
a41 1
\fISelection\fR defaults to PRIMARY and \fIwindow\fR defaults to ``.''.
d47 2
a48 1
\fIwindow\fR defaults to ``.''. 
d50 3
a52 1
(the desired ``target'' for conversion, in ICCCM terminology), and
d95 1
a95 1
just as if the selection didn't exist at all.
d111 1
a111 1
selection requesters that don't use Tk.  If Tk is being
d124 2
a125 1
\fIwindow\fR defaults to ``.''.
@


1.8
log
@Lots of improvements to look and feel of manual pages
@
text
@d40 1
a40 2
\fISelection\fR defaults to PRIMARY and \fIwindow\fR defaults to
.QW . .
d46 1
a46 2
\fIwindow\fR defaults to
.QW . . 
d48 1
a48 3
(the desired
.QW target
for conversion, in ICCCM terminology), and
d120 1
a120 2
\fIwindow\fR defaults to
.QW . .
@


1.7
log
@Purge old and inaccurate .VS/.VE macros.
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: selection.n,v 1.6 2004/10/28 12:25:53 dkf Exp $
d40 2
a41 1
\fISelection\fR defaults to PRIMARY and \fIwindow\fR defaults to ``.''.
d47 2
a48 1
\fIwindow\fR defaults to ``.''. 
d50 3
a52 1
(the desired ``target'' for conversion, in ICCCM terminology), and
d124 2
a125 1
\fIwindow\fR defaults to ``.''.
@


1.7.2.1
log
@merge updates from HEAD
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: selection.n,v 1.7 2005/04/06 21:11:54 dkf Exp $
d40 1
a40 2
\fISelection\fR defaults to PRIMARY and \fIwindow\fR defaults to
.QW . .
d46 1
a46 2
\fIwindow\fR defaults to
.QW . .
d48 1
a48 3
(the desired
.QW target
for conversion, in ICCCM terminology), and
d53 1
a53 2
formats, such as STRING, UTF8_STRING, ATOM, INTEGER, etc. (this format
is different
a58 2
Note that \fBselection get\fR does not retrieve the selection in the
UTF8_STRING format unless told to.
d60 1
a60 1
\fBselection handle\fR ?\fB\-selection\fR \fIs\fR? ?\fB\-type\fR \fIt\fR? ?\fB\-format\fR \fIf\fR? \fIwindow command\fR
d62 7
a68 9
be executed whenever selection \fIs\fR is owned by \fIwindow\fR and
someone attempts to retrieve it in the form given by type \fIt\fR
(e.g. \fIt\fR is specified in the \fBselection get\fR command).
\fIS\fR defaults to PRIMARY, \fIt\fR defaults to STRING, and
\fIf\fR defaults to STRING.  If \fIcommand\fR is an empty string
then any existing handler for \fIwindow\fR, \fIt\fR, and
\fIs\fR is removed.
Note that when the selection is handled as type STRING it is also
automatically handled as type UTF8_STRING as well.
d91 1
a91 1
just as if the selection did not exist at all.
d97 1
a97 3
just in the form returned by \fIcommand\fR, in the system \fBencoding\fR;
the UTF8_STRING format always uses UTF-8 as its encoding).
If \fIformat\fR is
d107 1
a107 1
selection requesters that do not use Tk.  If Tk is being
d120 1
a120 2
\fIwindow\fR defaults to
.QW . .
d163 1
d166 1
@


1.6
log
@More minor doc fixes
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: selection.n,v 1.5 2004/06/21 21:51:20 dkf Exp $
a75 1
.VS
a88 1
.VE
@


1.5
log
@Added examples
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: selection.n,v 1.4 2001/06/04 03:15:20 hobbs Exp $
d136 1
a136 1
set selContents [\fBselection\fR get \-selection SECONDARY]
d142 1
a142 1
foreach type [\fBselection\fR get \-type TARGETS] {
d152 1
a152 1
\fBselection\fR handle \-selection SECONDARY . getData
d160 1
a160 1
\fBselection\fR own \-command lost \-selection SECONDARY .
@


1.4
log
@	* doc/selection.n:
	* doc/clipboard.n: added SEE ALSOs to cross-reference selection
	and clipboard, with extra note for clipboard command in selection
	docs.  [Patch #422256]
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: selection.n,v 1.3 1999/06/03 18:50:45 stanton Exp $
d131 34
d167 1
a167 1
clipboard
@


1.4.4.1
log
@More backporting of doc fixes
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: selection.n,v 1.4 2001/06/04 03:15:20 hobbs Exp $
a130 34
.SH EXAMPLES
On X11 platforms, one of the standard selections available is the
SECONDARY selection. Hardly anything uses it, but here is how to read
it using Tk:
.CS
set selContents [\fBselection get\fR \-selection SECONDARY]
.CE
.PP
Many different types of data may be available for a selection; the
special type TARGETS allows you to get a list of available types:
.CS
foreach type [\fBselection get\fR \-type TARGETS] {
   puts "Selection PRIMARY supports type $type"
}
.CE
.PP
To claim the selection, you must first set up a handler to supply the
data for the selection.  Then you have to claim the selection...
.CS
# Set up the data handler ready for incoming requests
set foo "This is a string with some data in it... blah blah"
\fBselection handle\fR \-selection SECONDARY . getData
proc getData {offset maxChars} {
   puts "Retrieving selection starting at $offset"
   return [string range $::foo $offset [expr {$offset+$maxChars}]]
}

# Now we grab the selection itself
puts "Claiming selection"
\fBselection own\fR \-command lost \-selection SECONDARY .
proc lost {} {
   puts "Lost selection"
}
.CE
d133 1
a133 1
clipboard(n)
@


1.3
log
@* unix/tkUnixSelect.c:
* tests/unixSelect.test:
* generic/tkSelect.c: Fixed selection code to handle Unicode data
in COMPOUND_TEXT and STRING selections. [Bug: 1791]
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: selection.n,v 1.2 1998/09/14 18:22:59 stanton Exp $
d26 3
d131 3
@


1.3.12.1
log
@sync with head
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: selection.n,v 1.4 2001/06/04 03:15:20 hobbs Exp $
a25 3
Note that for management of the CLIPBOARD selection (see below), the
\fBclipboard\fR command may also be used.
.PP
a127 3

.SH "SEE ALSO"
clipboard
@


1.3.14.1
log
@        * Merged in updates from HEAD branch.
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: selection.n,v 1.4 2001/06/04 03:15:20 hobbs Exp $
a25 3
Note that for management of the CLIPBOARD selection (see below), the
\fBclipboard\fR command may also be used.
.PP
a127 3

.SH "SEE ALSO"
clipboard
@


1.2
log
@Replaced SCCS strings, fixed binary files
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id$
d11 1
a11 1
.TH selection n 4.0 Tk "Tk Built-In Commands"
d73 6
a78 5
are \fIoffset\fR and \fImaxBytes\fR:  \fIoffset\fR specifies a starting
character position in the selection and \fImaxBytes\fR gives the maximum
number of bytes to retrieve.  The command should return a value consisting
of at most \fImaxBytes\fR of the selection, starting at position
\fIoffset\fR.  For very large selections (larger than \fImaxBytes\fR)
d81 1
a81 1
whose length is less than \fImaxBytes\fR, the return value is assumed to
d83 1
a83 1
\fIcommand\fR's result is equal to \fImaxBytes\fR then
d85 3
a87 2
returns a result shorter than \fImaxBytes\fR.  The value of \fImaxBytes\fR
will always be relatively large (thousands of bytes).
@


1.1
log
@Initial revision
@
text
@d8 1
a8 1
'\" SCCS: @@(#) selection.n 1.18 96/08/27 13:21:51
@


1.1.4.1
log
@Merged 8.0.3 changes into 8.1
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: selection.n,v 1.2 1998/09/14 18:22:59 stanton Exp $
@


