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: GetSelect.3,v 1.1.1.1 2002-01-16 10:25:48 markom Exp $
|
9 |
|
|
'\"
|
10 |
|
|
.so man.macros
|
11 |
|
|
.TH Tk_GetSelection 3 4.0 Tk "Tk Library Procedures"
|
12 |
|
|
.BS
|
13 |
|
|
.SH NAME
|
14 |
|
|
Tk_GetSelection \- retrieve the contents of a selection
|
15 |
|
|
.SH SYNOPSIS
|
16 |
|
|
.nf
|
17 |
|
|
\fB#include \fR
|
18 |
|
|
.sp
|
19 |
|
|
int
|
20 |
|
|
\fBTk_GetSelection\fR(\fIinterp, tkwin, selection, target, proc, clientData\fR)
|
21 |
|
|
.SH ARGUMENTS
|
22 |
|
|
.AS Tk_GetSelProc clientData
|
23 |
|
|
.AP Tcl_Interp *interp in
|
24 |
|
|
Interpreter to use for reporting errors.
|
25 |
|
|
.AP Tk_Window tkwin in
|
26 |
|
|
Window on whose behalf to retrieve the selection (determines
|
27 |
|
|
display from which to retrieve).
|
28 |
|
|
.AP Atom selection in
|
29 |
|
|
The name of the selection to be retrieved.
|
30 |
|
|
.AP Atom target in
|
31 |
|
|
Form in which to retrieve selection.
|
32 |
|
|
.AP Tk_GetSelProc *proc in
|
33 |
|
|
Procedure to invoke to process pieces of the selection as they
|
34 |
|
|
are retrieved.
|
35 |
|
|
.AP ClientData clientData in
|
36 |
|
|
Arbitrary one-word value to pass to \fIproc\fR.
|
37 |
|
|
.BE
|
38 |
|
|
|
39 |
|
|
.SH DESCRIPTION
|
40 |
|
|
.PP
|
41 |
|
|
\fBTk_GetSelection\fR retrieves the selection specified by the atom
|
42 |
|
|
\fIselection\fR in the format specified by \fItarget\fR. The
|
43 |
|
|
selection may actually be retrieved in several pieces; as each piece
|
44 |
|
|
is retrieved, \fIproc\fR is called to process the piece. \fIProc\fR
|
45 |
|
|
should have arguments and result that match the type
|
46 |
|
|
\fBTk_GetSelProc\fR:
|
47 |
|
|
.CS
|
48 |
|
|
typedef int Tk_GetSelProc(
|
49 |
|
|
ClientData \fIclientData\fR,
|
50 |
|
|
Tcl_Interp *\fIinterp\fR,
|
51 |
|
|
char *\fIportion\fR);
|
52 |
|
|
.CE
|
53 |
|
|
The \fIclientData\fR and \fIinterp\fR parameters to \fIproc\fR
|
54 |
|
|
will be copies of the corresponding arguments to
|
55 |
|
|
\fBTk_GetSelection\fR. \fIPortion\fR will be a pointer to
|
56 |
|
|
a string containing part or all of the selection. For large
|
57 |
|
|
selections, \fIproc\fR will be called several times with successive
|
58 |
|
|
portions of the selection. The X Inter-Client Communication
|
59 |
|
|
Conventions Manual allows a selection to be returned in formats
|
60 |
|
|
other than strings, e.g. as an array of atoms or integers. If
|
61 |
|
|
this happens, Tk converts the selection back into a string
|
62 |
|
|
before calling \fIproc\fR. If a selection is returned as an
|
63 |
|
|
array of atoms, Tk converts it to a string containing the atom names
|
64 |
|
|
separated by white space. For any other format besides string,
|
65 |
|
|
Tk converts a selection to a string containing hexadecimal
|
66 |
|
|
values separated by white space.
|
67 |
|
|
.PP
|
68 |
|
|
\fBTk_GetSelection\fR returns to its caller when the selection has
|
69 |
|
|
been completely retrieved and processed by \fIproc\fR, or when a
|
70 |
|
|
fatal error has occurred (e.g. the selection owner didn't respond
|
71 |
|
|
promptly). \fBTk_GetSelection\fR normally returns TCL_OK; if
|
72 |
|
|
an error occurs, it returns TCL_ERROR and leaves an error message
|
73 |
|
|
in \fIinterp->result\fR. \fIProc\fR should also return either
|
74 |
|
|
TCL_OK or TCL_ERROR. If \fIproc\fR encounters an error in dealing with the
|
75 |
|
|
selection, it should leave an error message in \fIinterp->result\fR
|
76 |
|
|
and return TCL_ERROR; this will abort the selection retrieval.
|
77 |
|
|
|
78 |
|
|
.SH KEYWORDS
|
79 |
|
|
format, get, selection retrieval
|