Definitions for the Clipboard to hold Cut or Copied data for Pasting TClipboard - area for holding information that has been cut or copied, ready for pasting

TClipboard - area for holding information that has been cut or copied, ready for pasting.

The clipboard object encapsulates the Windows clipboard and the three standard Gtk selections. For each of the three clipboards/selections there is an object: , and . There is no difference between the three objects except their type.

A lot of information about Clipboard Formats, including predefined formats for Delphi/Kylix compatibility, is found in the LCLType unit, at TClipboardFormat, TClipboardType, ClipboardTypeName, TPredefinedClipboardFormat, PredefinedClipboardMimeTypes

TClipboardFormat, TClipboardType, ClipboardTypeName, TPredefinedClipboardFormat, PredefinedClipboardMimeTypes
If not already done this functions acquires ownership of the clipboard. Acquiring ownership clears the clipboard. If the format already exists it replaces the old content otherwise it is added. The format CF_TEXT is handled by AsText and SetTextBuf. Use those functions instead. Acquires ownership of the Clipboard and adds a format True if format added correctly Clear the clipboard Close down the clipboard Create - Constructor: make a new instance of a clipboard AClipboardType - optional argument specifying type of clipboard to be created FindPictureFormatID - search for the first format ID that is a graphic Returns a Clipboard format FindFormatID - find a Format ID that has the specified name Returns a Clipboard format GetComponent - read a component from the clipboard GetFormat - read information on format from the clipboard True if Format found SupportedFormats - fills a stringlist with the names of the supported MIME types GetTextBuf - reads text from the clipboard and returns the number of characters Number of characters in text buffer HasFormat - look up the list to see if the format is supported. If a TPicture format is specified, all graphic formats are searched. True if format is supported HasFormatName - checks if data have format with specified name True if named format found HasPictureFormat - checks whether data are formatted as a picture True if formatted as picture Open the clipboard to receive and transmit data Write specified component to the Clipboard SetSupportedFormats - set all supported formats at once

SetSupportedFormats - set all supported formats at once

All data will be empty.

This procedure is useful if setting the OnRequest event to put the data on the fly.

Example: Using the PrimarySelection from synedit.pp

procedure TCustomSynEdit.AquirePrimarySelection; var FormatList: TClipboardFormat; begin if (not SelAvail) or (PrimarySelection.OnRequest=@PrimarySelectionRequest) then exit; FormatList:=CF_TEXT; PrimarySelection.SetSupportedFormats(1,@FormatList); PrimarySelection.OnRequest:=@PrimarySelectionRequest; end;
AsText - holds the textual data in the clipboard as a string Puts a HTML string on the clipboard. Puts a HTML string on the clipboard. On Windows it will automatically insert a ClipBoard Header. The procedure can also (optionally) set a provided plaintext representation of the HTLM on the ClipBoard. The HTML string that shall be put on the ClipBoard Optional plain text (string) representation of the HTML The optional string parameter PlainText is meant to be a plain text representation of the HTML string. The user is responsible for the contents of this variable. The value of PlainText can later be retrieved via the AsText property. If PlainText is an empty string, no plain text is added to the ClipBoard, nor is the current plain text content of the ClipBoard cleared. Retrieves the HTML content of the clipboard (if available) Retrieves the HTML content of the clipboard (if available). On Windows it will automatically remove the clipboard header that Windows inserts. The resulting HTML string will be UTF-8 encoded. The HTML content of the clipboard as a string. Empty string if the function fails. ClipboardType - ctPrimarySelection, ctSecondarySelection, ctClipboard FormatCount - the number of formats available Formats - the formats being used in the current clipboard

Formats - the formats being used in the current clipboard

You can read the formats with this property one by one. But this will result in many requests, which can be very slow (especially on terminals).

Better use "SupportedFormats".

OnRequest - event handler for a request for clipboard data

OnRequest - event handler for a request for clipboard data

If the clipboard has the ownership, this event will be called each time data are requested from the clipboard by the application or another application.

There is one special case:

If the clipboard loses ownership the OnRequest event will be called with FormatID=0. This event will be erased on lost of ownership.

If the OnRequest event was already set before, the prior method will be called with FormatID=0 to be notified of the loss.

PrimarySelection - the first selection if multiple clipboards exist The PrimarySelection is available on platforms like X. Normally when the user selects some text with the mouse the primary selection is set and when the user clicks the middle mouse button the text is copied to the mouse position. On platforms without multiple clipboards, the PrimarySelection still works in the LCL application, but does not communicate with other applications. Returns a variable of type TClipboard SecondarySelection - the second selection if multiple clipboards exist The SecondarySelection is available on platforms like X. See PrimarySelection for more details. There is no standard how to use the secondary selection, so it is free to use. X supports a dozen more selections, but they are not supported by the LCL. Returns a variable of type TClipboard Clipboard the function called to access the clipboard with an optional type specifier The Clipboard is available on most platforms and normally used by Copy/Paste. Returns a variable of type TClipboard ClipboardType - optional argument to specify type of clipboard SetClipboard - sets up and returns a NewClipboard, with an optional type specifier Returns a variable of type TClipboard ClipboardType - optional argument to specify type of clipboard NewClipboard - the new clipboard to be set up FreeAllClipboards - frees all existing clipboards, releasing their resources RegisterClipboardFormat add the supplied format name to the register of clipboard formats Returns the registered clipboard format The name of the required format as a string GetComponentAsText - read the component as text, if supported