clipboard
Guide: Entry and spinbox
Puts text on the clipboard and reads it back.
clipboard SUBCOMMAND ?ARG ...?
Description
The clipboard of the app keeps data of one or more types. Each type has a name, such as STRING, and a string of data. clipboard clear empties it, clipboard append adds data to a type, and clipboard get gives the data of a type.
After each change, the data of the type STRING goes to the clipboard of the system through the backend, so another program can paste it. clipboard get of STRING or UTF8_STRING gives the text of the system clipboard when another program put text there last. The data of the other types stays in the app.
In the web build, an app that runs from a URL has a clipboard of its own: its data stays in the app and does not go to the clipboard of the browser. The headless backend keeps the data in the app.
A subcommand can have a short form of two or more letters, such as clipboard ap for clipboard append.
Subcommands
| Subcommand | Description |
|---|---|
clipboard append | Adds data to the end of the data of a type on the clipboard. |
clipboard clear | Empties the clipboard. |
clipboard get | Gives the data of a type on the clipboard. |
Examples
% clipboard clear
> clipboard append "Hello, world"
> clipboard get
Hello, world
Errors
% clipboard
wrong # args: should be "clipboard option ?arg ...?"
-errorcode TCL WRONGARGS
% clipboard copy x
bad option "copy": must be append, clear, or get
-errorcode NONE
Differences from Tcl
- A subcommand of one letter, such as
clipboard a, is an error. Tk 8.6.16 accepts each unique short form, also of one letter. - The errors have the
-errorcodeNONE, except a wrong count of arguments. Tk 8.6.16 gives codes such asTCL LOOKUP INDEX optionandTK LOOKUP WINDOW.
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztk 1.0.0-beta.1