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
39

DESCRIPTION

41       Tk_GetSelection retrieves the selection specified by the atom selection
42       in  the  format  specified  by  target.   The selection may actually be
43       retrieved in several pieces; as each piece is retrieved, proc is called
44       to process the piece.  Proc should have arguments and result that match
45       the type Tk_GetSelProc:
46              typedef int Tk_GetSelProc(
47                ClientData clientData,
48                Tcl_Interp *interp,
49                char *portion);
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
55       allows  a  selection to be returned in formats other than strings, e.g.
56       as an array of atoms or integers.  If this  happens,  Tk  converts  the
57       selection  back  into  a string before calling proc.  If a selection is
58       returned as an array of atoms, Tk converts it to  a  string  containing
59       the  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
65       occurred (e.g. the selection owner didn't 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 interp->result.  Proc should
68       also return either TCL_OK or TCL_ERROR. If proc encounters an error  in
69       dealing  with  the  selection,  it  should  leave  an  error message in
70       interp->result and return TCL_ERROR;  this  will  abort  the  selection
71       retrieval.
72
73

KEYWORDS

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