clipboard.addText

From Inspired-Lua Wiki
Jump to navigation Jump to search

clipboard.addText is a function that is part of the clipboard functions.


The function sets the content of the clipboard, so it can be pasted somewhere else.

This has been introduced in TI-Nspire OS 3.0 (Changes).


Syntax

clipboard.addText(text)

Parameter Type Description
text
string The text you want to add to the clipboard

Example

--Clipboard test : Setting "Hello" in the clipboard and displaying it.

function on.paint(gc)
	text = clipboard.getText()
	gc:drawString(text, 100, 100, "top")
end

function on.enterKey() -- event that fires when the user presses the enter key.
	clipboard.addText("Hello")
	platform.window:invalidate() -- recall graph engine, i.e. call on.paint(gc)
end

This code will read the content of the clipboard and print it on the screen. When you press the enter key, it will put "Hello" in the clipboard.

See also