'\" '\" Copyright (c) 1990 The Regents of the University of California. '\" All rights reserved. '\" '\" Permission is hereby granted, without written agreement and without '\" license or royalty fees, to use, copy, modify, and distribute this '\" documentation for any purpose, provided that the above copyright '\" notice and the following two paragraphs appear in all copies. '\" '\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY '\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES '\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF '\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. '\" '\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, '\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY '\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS '\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO '\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. '\" '\" $Header: /user6/ouster/wish/man/RCS/GetSelect.3,v 1.6 93/04/01 09:41:39 ouster Exp $ SPRITE (Berkeley) '\" .so man.macros .HS Tk_GetSelection tkc .BS .SH NAME Tk_GetSelection \- retrieve the contents of the selection .SH SYNOPSIS .nf \fB#include \fR .sp int \fBTk_GetSelection\fR(\fIinterp, tkwin, target, proc, clientData\fR) .SH ARGUMENTS .AS Tk_GetSelProc clientData .AP Tcl_Interp *interp in Interpreter to use for reporting errors. .AP Tk_Window tkwin in Window on whose behalf to retrieve the selection (determines display from which to retrieve). .AP Atom target in Form in which to retrieve selection. .AP Tk_GetSelProc *proc in Procedure to invoke to process pieces of the selection as they are retrieved. .AP ClientData clientData in Arbitrary one-word value to pass to \fIproc\fR. .BE .SH DESCRIPTION .PP \fBTk_GetSelection\fR retrieves the selection in the format specified by \fItarget\fR. The selection may actually be retrieved in several pieces; as each piece is retrieved, \fIproc\fR is called to process the piece. \fIProc\fR should have arguments and result that match the type \fBTk_GetSelProc\fR: .nf .RS typedef int Tk_GetSelProc( .RS ClientData \fIclientData\fR, Tcl_Interp *\fIinterp\fR, char *\fIportion\fR); .RE .RE .fi The \fIclientData\fP and \fIinterp\fR parameters to \fIproc\fR will be copies of the corresponding arguments to \fBTk_GetSelection\fR. \fIPortion\fR will be a pointer to a string containing part or all of the selection. For large selections, \fIproc\fR will be called several times with sucessive portions of the selection. The X Inter-Client Communication Conventions Manual allows the selection to be returned in formats other than strings, e.g. as an array of atoms or integers. If this happens, Tk converts the selection back into a string before calling \fIproc\fR. If the selection is returned as an array of atoms, Tk converts it to a string containing the atom names separated by white space. For any other format besides string, Tk converts the selection to a string containing hexadecimal values separated by white space. .PP \fBTk_GetSelection\fR returns to its caller when the selection has been completely retrieved and processed by \fIproc\fR, or when a fatal error has occurred (e.g. the selection owner didn't respond promptly). \fBTk_GetSelection\fR normally returns TCL_OK; if an error occurs, it returns TCL_ERROR and leaves an error message in \fIinterp->result\fR. \fIProc\fR should also return either TCL_OK or TCL_ERROR. If \fIproc\fR encounters an error in dealing with the selection, it should leave an error message in \fIinterp->result\fR and return TCL_ERROR; this will abort the selection retrieval. .SH KEYWORDS format, get, selection retrieval