Tk_ClipboardClear(3tk)
π Tk_ClipboardClear β the 3tk page, bestie edition π
okay so you're in the Tk library procedures section of the manual, and this lil page is all about the clipboard. Two functions, one vibe: manage the clipboard β¨
β¨ NAME β¨
Tk_ClipboardClear, Tk_ClipboardAppend β manage the clipboard π
πΈ SYNOPSIS πΈ
#include <tk.h>
int
Tk_ClipboardClear(interp, tkwin)
int
Tk_ClipboardAppend(interp, tkwin, target, format, buffer)
π¦ ARGUMENTS π¦
Tcl_Interp *interp(in) β the interpreter we use to report errors. she's the messenger, basically πTk_Window tkwin(in) β the window that decides which display's clipboard we're messing with. location, location, location πAtom target(in) β the conversion type for this clipboard item; it means the same thing as thetargetargument toTk_CreateSelHandler. same energy, same meaning, no cap.Atom format(in) β the representation used when the data gets retrieved; identical meaning to theformatargument ofTk_CreateSelHandlerπ«Άconst char *buffer(in) β a null terminated string holding the data you wanna append to the clipboard π
π DESCRIPTION π
These two procedures manage the clipboard for Tk. The clipboard is typically managed by calling Tk_ClipboardClear once, then calling Tk_ClipboardAppend to add data for any number of targets. like, clear the deck, then pile on the data, periodt π
Tk_ClipboardClear 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 interpreter interp's result. Tk_ClipboardClear must be called before a sequence of Tk_ClipboardAppend calls can be issued. no clear, no appends, that's the rule bestie π
Tk_ClipboardAppend appends a buffer of data to the clipboard. The first buffer for a given target determines the format for that target. Any successive appends for that target must have the same format or an error will be returned. Tk_ClipboardAppend returns TCL_OK if the buffer is successfully copied onto the clipboard. If the clipboard is not currently owned by the application β either because Tk_ClipboardClear has not been called, or because ownership of the clipboard has changed since the last call to Tk_ClipboardClear β Tk_ClipboardAppend returns TCL_ERROR and leaves an error message in the result of interpreter interp. she said "not yours anymore, sorry babe" π
β οΈ atomicity check, bestie β οΈ In order to guarantee atomicity, no event handling should occur betweenTk_ClipboardClearand the followingTk_ClipboardAppendcalls (otherwise someone could retrieve a partially completed clipboard or claim ownership away from this application). don't let anyone peek mid-glowup π
π¨ re-entrancy warning, fr fr π¨Tk_ClipboardClearmay invoke callbacks, including arbitrary Tcl scripts, as a result of losing theCLIPBOARDselection, so any calling function should take care to be re-entrant at the pointTk_ClipboardClearis invoked. yes she might call back into you mid-function. iconic but dangerous π
π₯ KEYWORDS π₯
append, clipboard, clear, format, type
and that's the whole page, no notes β¨ this was Tk_ClipboardClear(3tk) from Tk 4.0 β mwah, go slay your clipboard management ππ¦π
π¦ where this page comes from
- debian trixie: tk9.0-doc 9.0.1-3
- ubuntu questing: tk9.0-doc 9.0.2-1
- ubuntu resolute: tk9.0-doc 9.0.3-1
- ubuntu stonking: tk9.0-doc 9.0.4-1
- Copyright (c) 1994 The Regents of the University of California
- Copyright (c) 1994-1996 Sun Microsystems, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms