Tk_ClipboardClear(3tk)

πŸ“¦
version 9.0.4 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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 the target argument to Tk_CreateSelHandler. same energy, same meaning, no cap.
  • Atom format (in) β€” the representation used when the data gets retrieved; identical meaning to the format argument of Tk_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 between Tk_ClipboardClear and the following Tk_ClipboardAppend calls (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_ClipboardClear may invoke callbacks, including arbitrary Tcl scripts, as a result of losing the CLIPBOARD selection, so any calling function should take care to be re-entrant at the point Tk_ClipboardClear is 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