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 pre-defined formats for Delphi/Kylix compatibility, is found in the LCLType unit, at TClipboardFormat, TClipboardType, ClipboardTypeName, TPredefinedClipboardFormat, PredefinedClipboardMimeTypes

TClipboardFormat, TClipboardType, ClipboardTypeName, TPredefinedClipboardFormat, PredefinedClipboardMimeTypes
True if format added correctly
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
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 clipoard format
The name of the required format as a string
GetComponentAsText
- read the component as text, if supported