Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > 9451edd25456e3a771e4c01f92dd0fc3 > files > 170

gcl-2.6.12-7.mga7.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>GCL TK Manual: selection</title>

<meta name="description" content="GCL TK Manual: selection">
<meta name="keywords" content="GCL TK Manual: selection">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="wm.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Control.html#Control" rel="up" title="Control">
<link href="send.html#send" rel="next" title="send">
<link href="raise.html#raise" rel="prev" title="raise">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="selection"></a>
<div class="header">
<p>
Next: <a href="send.html#send" accesskey="n" rel="next">send</a>, Previous: <a href="raise.html#raise" accesskey="p" rel="prev">raise</a>, Up: <a href="Control.html#Control" accesskey="u" rel="up">Control</a> &nbsp; [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<hr>
<a name="selection-1"></a>
<h3 class="section">3.17 selection</h3>

<p>selection \- Manipulate the X selection
</p><a name="Synopsis-30"></a>
<h4 class="unnumberedsubsec">Synopsis</h4>
<p><b>selection </b><i>option</i><span class="roman"> ?</span><i>arg arg ...</i>?
</p>
<a name="Description-28"></a>
<h4 class="unnumberedsubsec">Description</h4>

<p>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), except that it
supports only the primary selection.
</p>
<p>The first argument to <b>selection</b> determines the format of the
rest of the arguments and the behavior of the command.  The following
forms are currently supported:
</p>
<dl compact="compact">
<dt><b>selection :clear </b><i>window</i></dt>
<dd><p>If there is a selection anywhere on <i>window</i>&rsquo;s display, clear it
so that no window owns the selection anymore.  Returns an empty string.
</p></dd>
<dt><b>selection :get </b><span class="roman">?</span><i>type</i>?</dt>
<dd><p>Retrieves the value
of the primary selection and returns it as a result.
<b>Type</b> specifies the form in which the selection is to be
returned (the desired &ldquo;target&rdquo; 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.
<b>Type</b> 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 <b>selection</b>
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.
</p></dd>
<dt><b>selection :handle </b><i>window command </i><span class="roman">?</span><i>type</i><span class="roman">? ?</span><i>format</i>?</dt>
<dd><p>Creates a handler for selection requests, such that <i>command</i> will
be executed whenever the primary selection is
owned by <i>window</i> and someone attempts to retrieve it in the form
given by <i>type</i><span class="roman"> (e.g. </span><i>type</i><span class="roman"> is specified in the </span><b>selection :get</b>
command).  <i>Type</i> defaults to STRING.
If <i>command</i> is an empty string then any existing handler for
<i>window</i><span class="roman"> and </span><i>type</i> is removed.
</p>
<p>When the selection is requested and <i>window</i> is the selection :owner
and <i>type</i><span class="roman"> is the requested type, </span><i>command</i> will be executed
as a Tcl command with two additional numbers appended to it
(with space separators).  The two additional numbers
are <i>offset</i><span class="roman"> and </span><i>maxBytes</i><span class="roman">:  </span><i>offset</i> specifies a starting
character position in the selection and <i>maxBytes</i> gives the maximum
number of bytes to retrieve.  The command should return a value consisting
of at most <i>maxBytes</i> of the selection, starting at position
<i>offset</i><span class="roman">.  For very large selections (larger than </span><i>maxBytes</i>)
the selection will be retrieved using several invocations of <i>command</i>
with increasing <i>offset</i><span class="roman"> values.  If </span><i>command</i> returns a string
whose length is less than <i>maxBytes</i>, the return value is assumed to
include all of the remainder of the selection;  if the length of
<i>command</i><span class="roman">&rsquo;s result is equal to </span><i>maxBytes</i> then
<i>command</i> will be invoked again, until it eventually
returns a result shorter than <i>maxBytes</i><span class="roman">.  The value of </span><i>maxBytes</i>
will always be relatively large (thousands of bytes).
</p>
<p>If <i>command</i> returns an error then the selection retrieval is rejected
just as if the selection didn&rsquo;t exist at all.
</p>
<p>The <i>format</i> 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 <i>format</i> is
STRING, the selection is transmitted as 8-bit ASCII characters (i.e.
just in the form returned by <i>command</i><span class="roman">).  If </span><i>format</i> is
ATOM, then the return value from <i>command</i> 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 <i>format</i><span class="roman">, the return value from </span><i>command</i> 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.
</p>
<p>The <i>format</i> argument is needed only for compatibility with
selection requesters that don&rsquo;t use Tk.  If the Tk toolkit is being
used to retrieve the selection then the value is converted back to
a string at the requesting end, so <i>format</i> is
irrelevant.
.RE
</p></dd>
<dt><b>selection :own </b><span class="roman">?</span><i>window</i><span class="roman">? ?</span><i>command</i>?</dt>
<dd><p>If <i>window</i> is specified, then it becomes the new selection :owner
and the command returns an empty string as result.
The existing owner, if any, is notified that it has lost the selection.
If <i>command</i> is specified, it is a Tcl script to execute when
some other window claims ownership of the selection away from
<i>window</i>.
If neither <i>window</i><span class="roman"> nor </span><i>command</i> is specified then
the command returns the path name of the window in this application
that owns the selection, or an empty string if no window in this
application owns the selection.
</p>
</dd>
</dl>
<a name="Keywords-31"></a>
<h4 class="unnumberedsubsec">Keywords</h4>
<p>clear, format, handler, ICCCM, own, selection, target, type
</p><hr>
<div class="header">
<p>
Next: <a href="send.html#send" accesskey="n" rel="next">send</a>, Previous: <a href="raise.html#raise" accesskey="p" rel="prev">raise</a>, Up: <a href="Control.html#Control" accesskey="u" rel="up">Control</a> &nbsp; [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>



</body>
</html>