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
21                                              retrieve  the  selection (deter‐
22                                              mines  display  from  which   to
23                                              retrieve).
24
25       Atom selection (in)                    The  name of the selection to be
26                                              retrieved.
27
28       Atom target (in)                       Form in which to retrieve selec‐
29                                              tion.
30
31       Tk_GetSelProc *proc (in)               Procedure  to  invoke to process
32                                              pieces of the selection as  they
33                                              are retrieved.
34
35       ClientData clientData (in)             Arbitrary one-word value to pass
36                                              to proc.
37______________________________________________________________________________
38

DESCRIPTION

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

KEYWORDS

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