1Tk_GetSelection(3)           Tk Library Procedures          Tk_GetSelection(3)
2
3
4
5______________________________________________________________________________
6

NAME

8       Tk_GetSelection - retrieve the contents of a selection
9

SYNOPSIS

11       #include <tk.h>
12
13       int
14       Tk_GetSelection(interp, tkwin, selection, target, proc, clientData)
15

ARGUMENTS

17       Tcl_Interp *interp (in)                Interpreter to use for reporting
18                                              errors.
19
20       Tk_Window tkwin (in)                   Window on whose  behalf  to  re‐
21                                              trieve the selection (determines
22                                              display from which to retrieve).
23
24       Atom selection (in)                    The name of the selection to  be
25                                              retrieved.
26
27       Atom target (in)                       Form in which to retrieve selec‐
28                                              tion.
29
30       Tk_GetSelProc *proc (in)               Procedure to invoke  to  process
31                                              pieces  of the selection as they
32                                              are retrieved.
33
34       ClientData clientData (in)             Arbitrary one-word value to pass
35                                              to proc.
36______________________________________________________________________________
37

DESCRIPTION

39       Tk_GetSelection retrieves the selection specified by the atom selection
40       in the format specified by target.  The selection may actually  be  re‐
41       trieved  in  several pieces; as each piece is retrieved, proc is called
42       to process the piece.  Proc should have arguments and result that match
43       the type Tk_GetSelProc:
44
45              typedef int Tk_GetSelProc(
46                      ClientData clientData,
47                      Tcl_Interp *interp,
48                      char *portion);
49
50       The clientData and interp parameters to proc will be copies of the cor‐
51       responding arguments to Tk_GetSelection.  Portion will be a pointer  to
52       a  string  containing  part  or all of the selection.  For large selec‐
53       tions, proc will be called several times with  successive  portions  of
54       the selection.  The X Inter-Client Communication Conventions Manual al‐
55       lows a selection to be returned in formats other than strings, e.g.  as
56       an array of atoms or integers.  If this happens, Tk converts the selec‐
57       tion back into a string before calling proc.  If  a  selection  is  re‐
58       turned  as an array of atoms, Tk converts it to a string containing the
59       atom names separated by white space.   For  any  other  format  besides
60       string, Tk converts a selection to a string containing hexadecimal val‐
61       ues separated by white space.
62
63       Tk_GetSelection returns to its caller when the selection has been  com‐
64       pletely  retrieved and processed by proc, or when a fatal error has oc‐
65       curred (e.g. the selection owner did not respond promptly).   Tk_GetSe‐
66       lection  normally  returns  TCL_OK;   if  an  error  occurs, it returns
67       TCL_ERROR and leaves an error message in interpreter  interp's  result.
68       Proc should also return either TCL_OK or TCL_ERROR.  If proc encounters
69       an error in dealing with the selection, it should leave an  error  mes‐
70       sage  in  the interpreter result and return TCL_ERROR;  this will abort
71       the selection retrieval.
72

KEYWORDS

74       format, get, selection retrieval
75
76
77
78Tk                                    4.0                   Tk_GetSelection(3)
Impressum