<HTML><HEAD><TITLE>Tk Library Procedures - Tk_ClipboardClear manual page</TITLE></HEAD><BODY> <H3><A NAME="M2">NAME</A></H3> Tk_ClipboardClear, Tk_ClipboardAppend - Manage the clipboard <H3><A NAME="M3">SYNOPSIS</A></H3> <B>#include <tk.h></B><BR> int<BR> <B>Tk_ClipboardClear</B>(<I>interp, tkwin</I>)<BR> int<BR> <B>Tk_ClipboardAppend</B>(<I>interp, tkwin, target, format, buffer</I>)<BR> <H3><A NAME="M4">ARGUMENTS</A></H3> <DL> <P><DT><A HREF="../TclLib/Interp.htm">Tcl_Interp</A> <B>*interp</B> (in)<DD> Interpreter to use for reporting errors. <P><DT>Tk_Window <B>tkwin</B> (in)<DD> Window that determines which display's clipboard to manipulate. <P><DT>Atom <B>target</B> (in)<DD> Conversion type for this clipboard item; has same meaning as <I>target</I> argument to <B><A HREF="../TkLib/CrtSelHdlr.htm">Tk_CreateSelHandler</A></B>. <P><DT>Atom <B><A HREF="../TclCmd/format.htm">format</A></B> (in)<DD> Representation to use when data is retrieved; has same meaning as <I>format</I> argument to <B><A HREF="../TkLib/CrtSelHdlr.htm">Tk_CreateSelHandler</A></B>. <P><DT>char <B>*buffer</B> (in)<DD> Null terminated string containing the data to be appended to the clipboard. <P></DL> <H3><A NAME="M5">DESCRIPTION</A></H3> These two procedures manage the clipboard for Tk. The clipboard is typically managed by calling <B>Tk_ClipboardClear</B> once, then calling <B>Tk_ClipboardAppend</B> to add data for any number of targets. <P> <B>Tk_ClipboardClear</B> claims the CLIPBOARD selection and frees any data items previously stored on the clipboard in this application. It normally returns TCL_OK, but if an error occurs it returns TCL_ERROR and leaves an error message in <I>interp->result</I>. <B>Tk_ClipboardClear</B> must be called before a sequence of <B>Tk_ClipboardAppend</B> calls can be issued. <P> <B>Tk_ClipboardAppend</B> appends a buffer of data to the clipboard. The first buffer for a given <I>target</I> determines the <I>format</I> for that <I>target</I>. Any successive appends for that <I>target</I> must have the same format or an error will be returned. <B>Tk_ClipboardAppend</B> returns TCL_OK if the buffer is successfully copied onto the clipboard. If the clipboard is not currently owned by the application, either because <B>Tk_ClipboardClear</B> has not been called or because ownership of the clipboard has changed since the last call to <B>Tk_ClipboardClear</B>, <B>Tk_ClipboardAppend</B> returns TCL_ERROR and leaves an error message in <I>interp->result</I>. <P> In order to guarantee atomicity, no event handling should occur between <B>Tk_ClipboardClear</B> and the following <B>Tk_ClipboardAppend</B> calls (otherwise someone could retrieve a partially completed clipboard or claim ownership away from this application). <P> <B>Tk_ClipboardClear</B> may invoke callbacks, including arbitrary Tcl scripts, as a result of losing the CLIPBOARD selection, so any calling function should take care to be reentrant at the point <B>Tk_ClipboardClear</B> is invoked. <H3><A NAME="M6">KEYWORDS</A></H3> <A href="../Keywords/A.htm#append">append</A>, <A href="../Keywords/C.htm#clipboard">clipboard</A>, <A href="../Keywords/C.htm#clear">clear</A>, <A href="../Keywords/F.htm#format">format</A>, <A href="../Keywords/T.htm#type">type</A> <HR><PRE> <A HREF="../copyright.htm">Copyright</A> © 1994 The Regents of the University of California. <A HREF="../copyright.htm">Copyright</A> © 1994-1996 Sun Microsystems, Inc. <A HREF="../copyright.htm">Copyright</A> © 1995-1997 Roger E. Critchlow Jr.</PRE> </BODY></HTML>