Skip to content

TWebClipboard

TWebClipboard is a non-visual control that manages paste from the clipboard at window level in the browser. When the user performs paste either from the browser menu or via the keyboard shortcut Ctrl-V, the TWebClipboard.OnTextData or TWebClipboard.OnImageData is triggered. When the user pasted text, OnTextData is triggered returning the text. When the user pasted an image, the event OnImageData is triggered returning the image as base64 encoded data URL.

The TWebClipboard component also allows to programmatically put text on the clipboard. This can be done via:

TWebClipboard.CopyToClipboard(const AValue: string);

Methods for TWebClipboard

Property Description
CopyToClipboard(const AValue: string) Sets the text to the clipboard
AsText: string; Gets content of the clipboard as text
SetAsText(const AValue: string) Sets AValue string to the clipboard
SetAsImage(img: TJSHTMLImageElement) Sets the image of the HTML image element as image on the clipboard
ElementID Optionally sets the HTML element ID for a HTML element in the form HTML file the label needs to be connected with. When connected, no new label is created but the Delphi class is connected with the existing HTML element in the form HTML file
Items Access to the checkbox captions in the group via a TStringList property

Events for TWebClipboard

Property Description
OnImageData Event triggered when an image is pasted from the clipboard
OnTextData Event triggered when text is pasted from the clipboard