1Tk_ClipboardClear(3) Tk Library Procedures Tk_ClipboardClear(3)
2
3
4
5______________________________________________________________________________
6
8 Tk_ClipboardClear, Tk_ClipboardAppend - Manage the clipboard
9
11 #include <tk.h>
12
13 int
14 Tk_ClipboardClear(interp, tkwin)
15
16 int
17 Tk_ClipboardAppend(interp, tkwin, target, format, buffer)
18
20 Tcl_Interp *interp (in) Interpreter to use for reporting
21 errors.
22
23 Tk_Window tkwin (in) Window that determines which dis‐
24 play's clipboard to manipulate.
25
26 Atom target (in) Conversion type for this clip‐
27 board item; has same meaning as
28 target argument to Tk_CreateSel‐
29 Handler.
30
31 Atom format (in) Representation to use when data
32 is retrieved; has same meaning
33 as format argument to Tk_Create‐
34 SelHandler.
35
36 const char *buffer (in) Null terminated string containing
37 the data to be appended to the
38 clipboard.
39______________________________________________________________________________
40
42 These two procedures manage the clipboard for Tk. The clipboard is
43 typically managed by calling Tk_ClipboardClear once, then calling
44 Tk_ClipboardAppend to add data for any number of targets.
45
46 Tk_ClipboardClear claims the CLIPBOARD selection and frees any data
47 items previously stored on the clipboard in this application. It nor‐
48 mally returns TCL_OK, but if an error occurs it returns TCL_ERROR and
49 leaves an error message in interpreter interp's result. Tk_Clipboard‐
50 Clear must be called before a sequence of Tk_ClipboardAppend calls can
51 be issued.
52
53 Tk_ClipboardAppend appends a buffer of data to the clipboard. The
54 first buffer for a given target determines the format for that target.
55 Any successive appends for that target must have the same format or an
56 error will be returned. Tk_ClipboardAppend returns TCL_OK if the buf‐
57 fer is successfully copied onto the clipboard. If the clipboard is not
58 currently owned by the application, either because Tk_ClipboardClear
59 has not been called or because ownership of the clipboard has changed
60 since the last call to Tk_ClipboardClear, Tk_ClipboardAppend returns
61 TCL_ERROR and leaves an error message in the result of interpreter in‐
62 terp.
63
64 In order to guarantee atomicity, no event handling should occur between
65 Tk_ClipboardClear and the following Tk_ClipboardAppend calls (otherwise
66 someone could retrieve a partially completed clipboard or claim owner‐
67 ship away from this application).
68
69 Tk_ClipboardClear may invoke callbacks, including arbitrary Tcl
70 scripts, as a result of losing the CLIPBOARD selection, so any calling
71 function should take care to be re-entrant at the point Tk_Clipboard‐
72 Clear is invoked.
73
75 append, clipboard, clear, format, type
76
77
78
79Tk 4.0 Tk_ClipboardClear(3)