clipboard.n
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:4k
- '"
- '" Copyright (c) 1994 The Regents of the University of California.
- '" Copyright (c) 1994-1996 Sun Microsystems, Inc.
- '"
- '" See the file "license.terms" for information on usage and redistribution
- '" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- '"
- '" RCS: @(#) $Id: clipboard.n,v 1.5.2.1 2004/10/28 10:19:29 dkf Exp $
- '"
- .so man.macros
- .TH clipboard n 8.4 Tk "Tk Built-In Commands"
- .BS
- '" Note: do not modify the .SH NAME line immediately below!
- .SH NAME
- clipboard - Manipulate Tk clipboard
- .SH SYNOPSIS
- fBclipboard fIoptionfR ?fIarg arg ...fR?
- .BE
- .SH DESCRIPTION
- .PP
- This command provides a Tcl interface to the Tk clipboard,
- which stores data for later retrieval using the selection mechanism
- (via the fB-selection CLIPBOARDfR option).
- In order to copy data into the clipboard, fBclipboard clearfR must
- be called, followed by a sequence of one or more calls to fBclipboard
- appendfR. To ensure that the clipboard is updated atomically, all
- appends should be completed before returning to the event loop.
- .PP
- The first argument to fBclipboardfR determines the format of the
- rest of the arguments and the behavior of the command. The following
- forms are currently supported:
- .PP
- .TP
- fBclipboard clearfR ?fB-displayoffR fIwindowfR?
- Claims ownership of the clipboard on fIwindowfR's display and removes
- any previous contents. fIWindowfR defaults to ``.''. Returns an
- empty string.
- .TP
- fBclipboard appendfR ?fB-displayoffR fIwindowfR? ?fB-formatfR fIformatfR? ?fB-typefR fItypefR? ?fB-|-fR? fIdatafR
- Appends fIdatafR to the clipboard on fIwindowfR's
- display in the form given by fItypefR with the representation given
- by fIformatfR and claims ownership of the clipboard on fIwindowfR's
- display.
- .RS
- .PP
- fITypefR specifies the form in which the selection is to be returned
- (the desired ``target'' for conversion, in ICCCM terminology), and
- should be an atom name such as STRING or FILE_NAME; see the
- Inter-Client Communication Conventions Manual for complete details.
- fITypefR defaults to STRING.
- .PP
- The fIformatfR 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 STRING. If fIformatfR is
- STRING, the selection is transmitted as 8-bit ASCII characters. If
- fIformatfR is ATOM, then the fIdatafR 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 fIformatfR, fIdatafR 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
- fBclipboard appendfR 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
- fItypefR must have the same fIformatfR.
- .PP
- The fIformatfR argument is needed only for compatibility with
- clipboard requesters that don't use Tk. If the Tk toolkit is being
- used to retrieve the CLIPBOARD selection then the value is converted back to
- a string at the requesting end, so fIformatfR is
- irrelevant.
- .PP
- A fB-|-fR argument may be specified to mark the end of options: the
- next argument will always be used as fIdatafR.
- This feature may be convenient if, for example, fIdatafR starts
- with a fB-fR.
- .RE
- .TP
- fBclipboard getfR ?fB-displayoffR fIwindowfR? ?fB-typefR fItypefR?
- .VS 8.4
- Retrieve data from the clipboard on fIwindowfR's display.
- fIwindowfR defaults to ".". fITypefR specifies the form in which
- the data is to be returned and should be an atom name such as STRING
- or FILE_NAME. fITypefR defaults to STRING. This command is
- equivalent to fBselection get -selection CLIPBOARDfR.
- .VE 8.4
- .SH EXAMPLES
- Get the current contents of the clipboard.
- .CS
- if {[catch {fBclipboard getfR} contents]} {
- # There were no clipboard contents at all
- }
- .CE
- .PP
- Set the clipboard to contain a fixed string.
- .CS
- fBclipboard clearfR
- fBclipboard appendfR "some fixed string"
- .CE
- .SH "SEE ALSO"
- selection(n)
- .SH KEYWORDS
- clear, format, clipboard, append, selection, type