User Tools

Site Tools


en:code:data:clipboard

Clipboard

This object allows you to have access to the system's clipboard. Under Linux you also have access to the selection buffer.

Functions

Clipboard

Constructor function.

Syntax

var myObject = new Clipboard();
var myObject = new Clipboard(mode);

Arguments

  1. mode - (Mode) the clipboard mode

Example

Create a Clipboard object.

var myObject = new Clipboard();

Create a Clipboard object to the selection buffer.

var myObject = new Clipboard(Clipboard.Selection);

Methods

setMode

Set the clipboard mode.

Syntax

myObject.setMode(mode);

Arguments

  1. mode - (Mode) the clipboard mode

Returns

  • (Clipboard) this Clipboard

Exceptions

  • (UnsupportedSelectionModeError) this mode is not supported under this operating system

setText

Sets the clipboard text.

Syntax

myObject.setText(text);

Arguments

  1. text - (string) the text to write to the clipboard

Returns

  • (Clipboard) this Clipboard

setImage

Sets the clipboard image.

Syntax

myObject.setImage(image);

Arguments

  1. image - (Image) the image to write to the clipboard

Returns

  • (Clipboard) this Clipboard

text

Returns the content of the clipboard as text.

Syntax

myObject.text();

Returns

  • (string) the content of the clipboard as text

image

Returns the content of the clipboard as an image.

Syntax

myObject.image();

Returns

  • (Image) the content of the clipboard as an image

dataType

Returns the current clipboard content type.

Syntax

myObject.dataType();

Returns

  • (DataType) the current clipboard content type

Attributes

text

The clipboard's content as text. (string)

image

The clipboard's content as an image. (Image)

Enumerations

Mode

Clipboard mode.

Values

  1. Standard: standard clipboard
  2. Selection: selection buffer (Linux only)
  3. FindBuffer: find buffer (Mac only)

DataType

The clipboard's data type.

Values

  1. Text: text
  2. Image: an image
en/code/data/clipboard.txt · Last modified: 2021/02/13 11:23 by 127.0.0.1