The CLIPBOARD object is an intrinsic object that represents the Windows Clipboard to provide an interface for common data transfer and exchange operations. It is automatically created at startup and is always available.
Developer Notes
- The CLIPBOARD object cannot be destroyed by the SYSTEM DESTROY method.
CLIPBOARD Properties
The CLIPBOARD object supports the following properties
Name | Description |
---|---|
FORMATLIST | Returns a list of available formats for the data that is currently on the clipboard. |
TEXT | Returns the contents of the clipboard as a text string. |
FORMATLIST property
Description
Returns a list of available formats for the data currently held on the clipboard.
Property Value
An @Fm-delimited list of format names.
Property Traits
Development | Runtime | Indexed | Scaled | Synthetic |
---|---|---|---|---|
N/a | Get | No | No | No |
Remarks
N/a.
Example
// FORMATLIST property example// // // // Copy the contents of an EditLine control onto the clipboard// // and then examine the formats that have been set.// // Select all the text// Call Set_Property( @Window : ".EDITLINE_1", "SELECTION", 1 : @fm : 0xFFFF ) // Copy it to the clipboard// Call Exec_Method( @Window : ".EDITLINE_1", "COPY" ) // Now get the list// FormatList = Get_Property( "CLIPBOARD", "FORMATLIST" ) // FormatList contains:// //// // <1> CF_UNICODETEXT// // <2> CF_LOCALE// // <3> CF_TEXT// // <4> CF_OEMTEXT//
See Also
TEXT property, GETDATA method, SETDATA method.
TEXT property
Description
Gets or sets the data on the clipboard in a textual format.
Property Value
The clipboard data represented as a text string.
Property Traits
Development | Runtime | Indexed | Scaled | Synthetic |
---|---|---|---|---|
N/a | Get/Set | No | No | No |
Remarks
When used with Get_Property the PS first looks to see if it can find a Unicode data string on the clipboard (CF_UNICODETEXT format) and if so it returns that. If the Unicode format is not available it looks for a CF_TEXT formatted string and returns that instead. The normal UTF8 translation rules apply to the returned value.
When used with Set_Property the PS will place both CF_UNICODETEXT and CF_TEXT formatted data on the clipboard.
Example
// TEXT property example// // // // Copy the contents of an EditLine control onto the clipboard// // and then examine the text.// // Select all the text// Call Set_Property( @Window : ".EDITLINE_1", "SELECTION", 1 : @fm : 0xFFFF ) // Copy it to the clipboard// Call Exec_Method( @Window : ".EDITLINE_1", "COPY" ) // Now get the text// ClipText = Get_Property( "CLIPBOARD", "TEXT" )
See Also
FORMATLIST property, GETDATA method, SETDATA method.
CLIPBOARD Methods
The CLIPBOARD object supports the following methods:
Name | Description |
---|---|
EMPTY | Clears the contents of the clipboard. |
GETDATA | Retrieves data from the clipboard in the specified format. |
SETDATA | Places data on the clipboard in the specified format. |
EMPTY Method
Description
Clears the contents of the clipboard.
Syntax
SuccessFlag = Exec_Method( "CLIPBOARD", "EMPTY" )
Parameters
N/a.
Returns
TRUE$ if the clipboard was emptied, or FALSE$ otherwise.
Remarks
N/a.
Example
Clear the clipboard contents
IsCleared = Exec_Method( "CLIPBOARD", "EMPTY", DirName )
See also
N/a.
GETDATA Method
Description
Retrieves data from the Windows clipboard in the specified format.
Syntax
ClipData = Exec_Method( "CLIPBOARD", |
"GETDATA", |
FormatName )
Parameters
Name | Required | Description |
---|---|---|
FormatName | Yes | Name of the format to retrieve the data in. This can be one of the common formats listed below (pass as a literal string), or a custom format (can be any string) * CF_TEXT * CF_BITMAP * CF_METAFILEPICT * CF_SYLK * CF_DIF * CF_TIFF * CF_OEMTEXT * CF_DIB * CF_PALETTE * CF_PENDATA * CF_RIFF * CF_WAVE * CF_UNICODETEXT * CF_ENHMETAFILE * CF_HDROP * CF_LOCALE * CF_DIBV5 |
Returns
The data from the clipboard in the requested format if available.
Remarks
The GETDATA method is basically a wrapper around the GetClipboardData Windows API function, so it is worth examining the documentation for this on the Microsoft website to get a better idea of the capabilities of this method.
Example
// CLIPBOARD GETDATA example// //// // Look to see if the clipboard has a custom data format// FormatID = "My.Custom.Format" ClipFormats = Get_Property( "CLIPBOARD", "FORMATLIST" ) Locate FormatID in ClipFormats Using @Fm Setting Pos Then // Found It// ClipData = Exec_Method( "CLIPBOARD", "GETDATA", FormatID ) End // Look to see if the clipboard has a bitmap// FormatID = "CF_BITMAP" ClipFormats = Get_Property( "CLIPBOARD", "FORMATLIST" ) Locate FormatID in ClipFormats Using @Fm Setting Pos Then // Found It// BitmapData = Exec_Method( "CLIPBOARD", "CLIPBOARD", "GETDATA", FormatID ) End
See also
FORMATLIST property, TEXT property, SETDATA method.
SETDATA Method
Description
Places data on the clipboard in the specified format.
Syntax
SuccessFlag = Exec_Method( "CLIPBOARD", |
"SETDATA", |
FormatName, |
ClipData )
Parameters
Name | Required | Description |
---|---|---|
FormatName | Yes | Name of the format to mark the data as. This can be one of the common formats listed below (pass as a literal string), or a custom format (can be any string) * CF_TEXT * CF_BITMAP * CF_METAFILEPICT * CF_SYLK * CF_DIF * CF_TIFF * CF_OEMTEXT * CF_DIB * CF_PALETTE * CF_PENDATA * CF_RIFF * CF_WAVE * CF_UNICODETEXT * CF_ENHMETAFILE * CF_HDROP * CF_LOCALE * CF_DIBV5 |
ClipData | Yes | The data to set. The actual contents depend on the format. |
Returns
TRUE$ if the data was set on the clipboard successfully, or FALSE$ otherwise.
Remarks
The SETDATA method can be called multiple times to set the data in different formats on the clipboard.
This is basically a wrapper around the SetClipboardData Windows API function, so it is worth examining at the documentation for this on the Microsoft website to get a better idea of the capabilities of this method.
Example
// CLIPBOARD SETDATA example// //// // Set some html data and a text version// Declare Function Str_Unicode FormatID = "text/html" ClipData = "<b>HTML<b> text <i>to</i> set." Call Exec_Method( "CLIPBOARD", "SETDATA", FormatID, ClipData ) // Set the text as Unicode text (don’t forget the trailing null char!)// FormatID = "CF_UNICODETEXT" ClipData = Str_Unicode( "Text to set" : \00\ ) Call Exec_Method( "CLIPBOARD", "SETDATA", FormatID, ClipData )
See also
FORMATLIST property, TEXT property, SETDATA method.