Difference between revisions of "clipboard.addText"
Jump to navigation
Jump to search
Jimbauwens (talk | contribs) |
|||
Line 1: | Line 1: | ||
− | clipboard.'''addText''' is a function that is part of the | + | clipboard.'''addText''' is a function that is part of the [[:Category:clipboard|clipboard]] functions. |
<br> | <br> | ||
+ | The function sets the content of the clipboard, so it can be pasted somewhere else. <br> | ||
+ | <br /> | ||
− | + | {{Since|3.0}} | |
− | |||
− | |||
== Syntax == | == Syntax == | ||
− | clipboard.'''addText'''( | + | clipboard.'''addText'''(text) |
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
− | ! Parameter | + | ! Parameter |
+ | ! Type | ||
! Description | ! Description | ||
|- | |- | ||
− | | <u> | + | | <u>text</u> |
− | | | + | | string |
+ | | The text you want to add to the clipboard | ||
|} | |} | ||
== Example == | == Example == | ||
− | <source lang="lua">--Clipboard test | + | <source lang="lua">--Clipboard test : Setting "Hello" in the clipboard and displaying it. |
function on.paint(gc) | function on.paint(gc) | ||
− | + | text = clipboard.getText() | |
− | gc:drawString( | + | gc:drawString(text, 100, 100, "top") |
end | end | ||
− | function on. | + | function on.enterKey() -- event that fires when the user presses the enter key. |
− | clipboard.addText( | + | clipboard.addText("Hello") |
− | platform.window:invalidate() -- recall graph engine | + | platform.window:invalidate() -- recall graph engine, i.e. call on.paint(gc) |
end</source> | end</source> | ||
− | This code will read the content of the clipboard and print it on the screen. When you press | + | 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 == | == See also == | ||
− | |||
*[[clipboard.getText|clipboard.getText]] | *[[clipboard.getText|clipboard.getText]] | ||
− | [[Category:clipboard | + | [[Category:clipboard]] |
Revision as of 11:41, 25 May 2011
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.