Difference between revisions of "Clipboard.Text"

From Xojo Documentation

(Added project compatibility)
(Added Note about changing Text on macOS)
Line 9: Line 9:
 
{{Description
 
{{Description
 
|text = The text on the Clipboard. }}
 
|text = The text on the Clipboard. }}
 +
 +
== Notes ==
 +
On macOS, if you need to change the Text in the Clipboard after you have set it, you should create a new Clipboard object first.
  
 
== Sample Code ==
 
== Sample Code ==

Revision as of 22:00, 12 February 2021

Property (As String )
aClipboard.Text = newStringValue
or
StringValue = aClipboard.Text

Supported on Desktop, Mobile (iOS).

The text on the Clipboard.

Notes

On macOS, if you need to change the Text in the Clipboard after you have set it, you should create a new Clipboard object first.

Sample Code

This code is in the Action event of a button. It checks the Clipboard for text. If it finds text, it assigns it to the Text property of the TextField.

Var c As Clipboard

// create an instance of the clipboard
c = New Clipboard

// check for textAvailable
If c.TextAvailable Then
// text is available, set the TextField to it
TextField1.Value = c.Text
End If

// close it
c.Close