{"id":6182,"date":"2022-12-20T18:58:00","date_gmt":"2022-12-20T21:58:00","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/clipboard-mann\/"},"modified":"2022-12-20T18:58:00","modified_gmt":"2022-12-20T21:58:00","slug":"clipboard-mann","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/clipboard-mann\/","title":{"rendered":"clipboard (mann)"},"content":{"rendered":"<h1 align=\"center\">clipboard<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#EXAMPLES\">EXAMPLES<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#KEYWORDS\">KEYWORDS<\/a> <\/p>\n<hr>\n<p>______________________________________________________________________________<\/p>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">clipboard \u2212 Manipulate Tk clipboard<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>clipboard<\/b> <i>option<\/i> ?<i>arg arg &#8230;<\/i>? ______________________________________________________________________________<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This command provides a Tcl interface to the Tk clipboard, which stores data for later retrieval using the selection mechanism (via the <b>\u2212selection CLIPBOARD<\/b> option). In order to copy data into the clipboard, <b>clipboard clear<\/b> must be called, followed by a sequence of one or more calls to <b>clipboard append<\/b>. To ensure that the clipboard is updated atomically, all appends should be completed before returning to the event loop.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The first argument to <b>clipboard<\/b> determines the format of the rest of the arguments and the behavior of the command. The following forms are currently supported: <b><br \/> clipboard append<\/b> ?<b>\u2212displayof<\/b> <i>window<\/i>? ?<b>\u2212format<\/b> <i>format<\/i>? ?<b>\u2212type<\/b> <i>type<\/i>? ?<b>\u2212\u2212<\/b>? <i><br \/> data<\/i><\/p>\n<p style=\"margin-left:22%;\">Appends <i>data<\/i> to the clipboard on <i>window<\/i>\u2019s display in the form given by <i>type<\/i> with the representation given by <i>format<\/i> and claims ownership of the clipboard on <i>window<\/i>\u2019s display.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\"><i>Type<\/i> specifies the form in which the selection is to be returned (the desired \u201ctarget\u201d for conversion, in ICCCM terminology), and should be an atom name such as <b>STRING<\/b> or <b>FILE_NAME<\/b>; see the Inter-Client Communication Conventions Manual for complete details. <i>Type<\/i> defaults to <b>STRING<\/b>.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">The <i>format<\/i> argument specifies the representation that should be used to transmit the selection to the requester (the second column of Table 2 of the ICCCM), and defaults to <b>STRING<\/b>. If <i>format<\/i> is <b>STRING<\/b>, the selection is transmitted as 8-bit ASCII characters. If <i>format<\/i> is <b>ATOM<\/b>, then the <i>data<\/i> is divided into fields separated by white space; each field is converted to its atom value, and the 32-bit atom value is transmitted instead of the atom name. For any other <i>format<\/i>, <i>data<\/i> is divided into fields separated by white space and each field is converted to a 32-bit integer; an array of integers is transmitted to the selection requester. Note that strings passed to <b>clipboard append<\/b> are concatenated before conversion, so the caller must take care to ensure appropriate spacing across string boundaries. All items appended to the clipboard with the same <i>type<\/i> must have the same <i>format<\/i>.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">The <i>format<\/i> argument is needed only for compatibility with clipboard requesters that do not use Tk. If the Tk toolkit is being used to retrieve the <b>CLIPBOARD<\/b> selection then the value is converted back to a string at the requesting end, so <i>format<\/i> is irrelevant.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">A <b>\u2212\u2212<\/b> argument may be specified to mark the end of options: the next argument will always be used as <i>data<\/i>. This feature may be convenient if, for example, <i>data<\/i> starts with a <b>\u2212<\/b>.<\/p>\n<p style=\"margin-left:11%;\"><b>clipboard clear<\/b> ?<b>\u2212displayof<\/b> <i>window<\/i>?<\/p>\n<p style=\"margin-left:22%;\">Claims ownership of the clipboard on <i>window<\/i>\u2019s display and removes any previous contents. <i>Window<\/i> defaults to \u201c.\u201d. Returns an empty string.<\/p>\n<p style=\"margin-left:11%;\"><b>clipboard get<\/b> ?<b>\u2212displayof<\/b> <i>window<\/i>? ?<b>\u2212type<\/b> <i>type<\/i>?<\/p>\n<p style=\"margin-left:22%;\">Retrieve data from the clipboard on <i>window<\/i>\u2019s display. <i>Window<\/i> defaults to \u201c.\u201d. <i>Type<\/i> specifies the form in which the data is to be returned and should be an atom name such as <b>STRING<\/b> or <b>FILE_NAME<\/b>. <i>Type<\/i> defaults to <b>STRING<\/b>. This command is equivalent to \u201c<b>selection get \u2212selection CLIPBOARD<\/b>\u201d.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">Note that on modern X11 systems, the most useful type to retrieve for transferred strings is not <b>STRING<\/b>, but rather <b>UTF8_STRING<\/b>.<\/p>\n<h2>EXAMPLES <a name=\"EXAMPLES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Get the current contents of the clipboard.<\/p>\n<p style=\"margin-left:22%;\">if {[catch {<b>clipboard get<\/b>} contents]} { <br \/> # There were no clipboard contents at all <br \/> }<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Set the clipboard to contain a fixed string.<\/p>\n<p style=\"margin-left:22%;\"><b>clipboard clear <br \/> clipboard append<\/b> &#8220;some fixed string&#8221;<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">You can put custom data into the clipboard by using a custom <b>\u2212type<\/b> option. This is not necessarily portable, but can be very useful. The method of passing Tcl scripts this way is effective, but should be mixed with safe interpreters in production code.<\/p>\n<p style=\"margin-left:22%;\"># This is a very simple canvas serializer; <br \/> # it produces a script that recreates the item(s) when executed <br \/> proc getItemConfig {canvas tag} { <br \/> set script {} <br \/> foreach item [$canvas find withtag $tag] { <br \/> append script {$canvas create } [$canvas type $item] <br \/> append script { } [$canvas coords $item] { } <br \/> foreach config [$canvas itemconf $item] { <br \/> lassign $config name \u2212 \u2212 \u2212 value <br \/> append script [list $name $value] { } <br \/> } <br \/> append script n <br \/> } <br \/> return [string trim $script] <br \/> }<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\"># Set up a binding on a canvas to cut and paste an item <br \/> set c [canvas .c] <br \/> pack $c <br \/> $c create text 150 30 \u2212text &#8220;cut and paste me&#8221; <br \/> bind $c <<Cut>> { <b><br \/> clipboard clear <br \/> clipboard append \u2212type<\/b> TkCanvasItem  <br \/> [getItemConfig %W current] <br \/> # Delete because this is cut, not copy. <br \/> %W delete current <br \/> } <br \/> bind $c <<Paste>> { <br \/> catch { <br \/> set canvas %W <br \/> eval [<b>clipboard get \u2212type<\/b> TkCanvasItem] <br \/> } <br \/> }<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">interp(n), selection(n)<\/p>\n<h2>KEYWORDS <a name=\"KEYWORDS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">clear, format, clipboard, append, selection, type<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  clipboard \u2212 Manipulate Tk clipboard <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3783,1],"tags":[2819,2635],"class_list":["post-6182","post","type-post","status-publish","format-standard","hentry","category-n-comandos-tcl-tk","category-sin-categoria","tag-clipboard","tag-mann"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6182","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=6182"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6182\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=6182"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=6182"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=6182"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}