Tk_ClipboardClear(3)
β¨ Tk_ClipboardClear β Manage the clipboard β¨
okay bestie, welcome to the Tk Library Procedures glow-up π this one's from the Tk_ClipboardClear(3) page and it's literally all about putting stuff on the clipboard and taking it back off. think of the clipboard as the group chat of data: everybody wants in, but only one app gets to own it at a time π
πΈ SYNOPSIS πΈ
#include <tk.h>
int
Tk_ClipboardClear(interp, tkwin)
int
Tk_ClipboardAppend(interp, tkwin, target, format, buffer)
π¦ ARGUMENTS π¦
Tcl_Interp *interp(in) β the interpreter you use to report errors. she's the messenger when things go sideways πTk_Window tkwin(in) β the window that tells you which display's clipboard you're manipulating. like, which friend's drama are we in rn πAtom target(in) β the conversion type for this clipboard item; has the exact same meaning as thetargetargument toTk_CreateSelHandler. no cap.Atom format(in) β the representation to use when data is retrieved; has the exact same meaning as theformatargument toTk_CreateSelHandler.const char *buffer(in) β a null-terminated string holding the data you're appending to the clipboard. yes, null terminated, fr fr.
π DESCRIPTION π
These two procedures manage the clipboard for Tk. the whole vibe is: you call Tk_ClipboardClear once, then call Tk_ClipboardAppend to add data for any number of targets. it's giving "clean slate, then decorate" β¨
Tk_ClipboardClear claims the CLIPBOARD selection and frees any data items previously stored on the clipboard in this application. she normally returns TCL_OK, but if an error occurs she returns TCL_ERROR and leaves an error message in interpreter interp's result. important: Tk_ClipboardClear must be called before a sequence of Tk_ClipboardAppend calls can be issued. like, she goes first. main character energy π
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 β consistency is key, bestie π Tk_ClipboardAppend returns TCL_OK if the buffer is successfully copied onto the clipboard. but 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 β then Tk_ClipboardAppend returns TCL_ERROR and leaves an error message in the result of interpreter interp. awkward, but she had to say it π
In order to guarantee atomicity, no event handling should occur between Tk_ClipboardClear and the following Tk_ClipboardAppend calls (otherwise someone could retrieve a partially completed clipboard or claim ownership away from this application). so like, don't go taking snack breaks mid-sequence, okay? π₯
β οΈ watch out: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. this one's highkey important β she can re-enter on you, so be ready π«Ά
π KEYWORDS π
append, clipboard, clear, format, type
alright that's the whole page, you ate that π
this was Tk, version 4.0, dated with the Tk_ClipboardClear(3) footer β go forth and claim that clipboard, queen ππ¦
π¦ where this page comes from
- alpine 3.23: tk9-doc 9.0.3-r0 Β· TCL
- alpine 3.24: tk9-doc 9.0.3-r2 Β· TCL
- fedora 43: tk-devel 1:9.0.2-1.fc43 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 43: tk-devel 1:9.0.2-1.fc43 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 44: tk-devel 1:9.0.2-1.fc44 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 44: tk-devel 1:9.0.2-1.fc44 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- nixos 26.05: tk 9.0.3
- nixpkgs unstable: tk 9.1.0
- 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-1017 on : a language model's rewrite of the original, under its terms