OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tk/] [doc/] [selection.n] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
'\"
2
'\" Copyright (c) 1990-1994 The Regents of the University of California.
3
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
4
'\"
5
'\" See the file "license.terms" for information on usage and redistribution
6
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
7
'\"
8
'\" RCS: @(#) $Id: selection.n,v 1.1.1.1 2002-01-16 10:25:49 markom Exp $
9
'\"
10
.so man.macros
11
.TH selection n 4.0 Tk "Tk Built-In Commands"
12
.BS
13
'\" Note:  do not modify the .SH NAME line immediately below!
14
.SH NAME
15
selection \- Manipulate the X selection
16
.SH SYNOPSIS
17
\fBselection \fIoption\fR ?\fIarg arg ...\fR?
18
.BE
19
 
20
.SH DESCRIPTION
21
.PP
22
This command provides a Tcl interface to the X selection mechanism and
23
implements the full selection functionality described in the
24
X Inter-Client Communication Conventions Manual (ICCCM).
25
.PP
26
The first argument to \fBselection\fR determines the format of the
27
rest of the arguments and the behavior of the command.  The following
28
forms are currently supported:
29
.PP
30
.TP
31
\fBselection clear\fR ?\fB\-displayof\fR \fIwindow\fR? ?\fB\-selection\fR \fIselection\fR?
32
If \fIselection\fR exists anywhere on \fIwindow\fR's display, clear it
33
so that no window owns the selection anymore.  \fISelection\fR
34
specifies the X selection that should be cleared, and should be an
35
atom name such as PRIMARY or CLIPBOARD; see the Inter-Client
36
Communication Conventions Manual for complete details.
37
\fISelection\fR defaults to PRIMARY and \fIwindow\fR defaults to ``.''.
38
Returns an empty string.
39
.TP
40
\fBselection get\fR ?\fB\-displayof\fR \fIwindow\fR? ?\fB\-selection\fR \fIselection\fR? ?\fB\-type\fR \fItype\fR?
41
Retrieves the value of \fIselection\fR from \fIwindow\fR's display and
42
returns it as a result.  \fISelection\fR defaults to PRIMARY and
43
\fIwindow\fR defaults to ``.''.
44
\fIType\fR specifies the form in which the selection is to be returned
45
(the desired ``target'' for conversion, in ICCCM terminology), and
46
should be an atom name such as STRING or FILE_NAME; see the
47
Inter-Client Communication Conventions Manual for complete details.
48
\fIType\fR defaults to STRING.  The selection owner may choose to
49
return the selection in any of several different representation
50
formats, such as STRING, ATOM, INTEGER, etc. (this format is different
51
than the selection type; see the ICCCM for all the confusing details).
52
If the selection is returned in a non-string format, such as INTEGER
53
or ATOM, the \fBselection\fR command converts it to string format as a
54
collection of fields separated by spaces: atoms are converted to their
55
textual names, and anything else is converted to hexadecimal integers.
56
.TP
57
\fBselection handle\fR ?\fB\-selection\fR \fIselection\fR? ?\fB\-type\fR \fItype\fR? ?\fB\-format\fR \fIformat\fR? \fIwindow command\fR
58
Creates a handler for selection requests, such that \fIcommand\fR will
59
be executed whenever \fIselection\fR is owned by \fIwindow\fR and
60
someone attempts to retrieve it in the form given by \fItype\fR
61
(e.g. \fItype\fR is specified in the \fBselection get\fR command).
62
\fISelection\fR defaults to PRIMARY, \fItype\fR defaults to STRING, and
63
\fIformat\fR defaults to STRING.  If \fIcommand\fR is an empty string
64
then any existing handler for \fIwindow\fR, \fItype\fR, and
65
\fIselection\fR is removed.
66
.RS
67
.PP
68
When \fIselection\fR is requested, \fIwindow\fR is the selection owner,
69
and \fItype\fR is the requested type, \fIcommand\fR will be executed
70
as a Tcl command with two additional numbers appended to it
71
(with space separators).
72
The two additional numbers
73
are \fIoffset\fR and \fImaxBytes\fR:  \fIoffset\fR specifies a starting
74
character position in the selection and \fImaxBytes\fR gives the maximum
75
number of bytes to retrieve.  The command should return a value consisting
76
of at most \fImaxBytes\fR of the selection, starting at position
77
\fIoffset\fR.  For very large selections (larger than \fImaxBytes\fR)
78
the selection will be retrieved using several invocations of \fIcommand\fR
79
with increasing \fIoffset\fR values.  If \fIcommand\fR returns a string
80
whose length is less than \fImaxBytes\fR, the return value is assumed to
81
include all of the remainder of the selection;  if the length of
82
\fIcommand\fR's result is equal to \fImaxBytes\fR then
83
\fIcommand\fR will be invoked again, until it eventually
84
returns a result shorter than \fImaxBytes\fR.  The value of \fImaxBytes\fR
85
will always be relatively large (thousands of bytes).
86
.PP
87
If \fIcommand\fR returns an error then the selection retrieval is rejected
88
just as if the selection didn't exist at all.
89
.PP
90
The \fIformat\fR argument specifies the representation that should be
91
used to transmit the selection to the requester (the second column of
92
Table 2 of the ICCCM), and defaults to STRING.  If \fIformat\fR is
93
STRING, the selection is transmitted as 8-bit ASCII characters (i.e.
94
just in the form returned by \fIcommand\fR).  If \fIformat\fR is
95
ATOM, then the return value from \fIcommand\fR is divided into fields
96
separated by white space;  each field is converted to its atom value,
97
and the 32-bit atom value is transmitted instead of the atom name.
98
For any other \fIformat\fR, the return value from \fIcommand\fR is
99
divided into fields separated by white space and each field is
100
converted to a 32-bit integer;  an array of integers is transmitted
101
to the selection requester.
102
.PP
103
The \fIformat\fR argument is needed only for compatibility with
104
selection requesters that don't use Tk.  If Tk is being
105
used to retrieve the selection then the value is converted back to
106
a string at the requesting end, so \fIformat\fR is
107
irrelevant.
108
.RE
109
.TP
110
\fBselection own\fR ?\fB\-displayof\fR \fIwindow\fR? ?\fB\-selection\fR \fIselection\fR?
111
.TP
112
\fBselection own\fR ?\fB\-command\fR \fIcommand\fR? ?\fB\-selection\fR \fIselection\fR? \fIwindow\fR
113
The first form of \fBselection own\fR returns the path name of the
114
window in this application that owns \fIselection\fR on the display
115
containing \fIwindow\fR, or an empty string if no window in this
116
application owns the selection.  \fISelection\fR defaults to PRIMARY and
117
\fIwindow\fR defaults to ``.''.
118
.PP
119
The second form of \fBselection own\fR causes \fIwindow\fR to become
120
the new owner of \fIselection\fR on \fIwindow\fR's display, returning
121
an empty string as result. The existing owner, if any, is notified
122
that it has lost the selection.
123
If \fIcommand\fR is specified, it is a Tcl script to execute when
124
some other window claims ownership of the selection away from
125
\fIwindow\fR.  \fISelection\fR defaults to PRIMARY.
126
 
127
.SH KEYWORDS
128
clear, format, handler, ICCCM, own, selection, target, type

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.