Difference between revisions of "clipboard.addText"

From Inspired-Lua Wiki
Jump to navigation Jump to search
(Created page with "<p>__NOTOC__ clipboard.<b>addText</b> is a function that is part of <a href=":Category:clipboard">Clipboard</a> Library. </p><p><br /> The function sets the content of the clipbo...")
 
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<p>__NOTOC__
+
clipboard.'''addText''' is a function that is part of the [[:Category:clipboard|clipboard]] functions.  
clipboard.<b>addText</b> is a function that is part of <a href=":Category:clipboard">Clipboard</a> Library.
 
</p><p><br />
 
The function sets the content of the clipboard. <br />
 
It accepts a string as input.</p><p><br />
 
<span class="fck_mw_template">{{Since|3.0}}</span>
 
</p>
 
<h2> Syntax  </h2>
 
<p>clipboard.<b>addText</b>(string)
 
</p>
 
<table class="wikitable">
 
  
<tr>
+
<br>  
<th> Parameter </th><th> Description
+
The function sets the content of the clipboard, so it can be pasted somewhere else. <br>  
</th></tr>
+
<br />
  
<tr>
+
{{Since|3.0}}
<td> <u>string</u> </td><td> String that you want to add to clipboad
 
</td></tr>
 
</table>
 
<h2> Example  </h2>
 
  
<h2> See also </h2>
+
== Syntax ==
<ul>
 
<li><a href="clipboard.setText">clipboard.setText</a></li>
 
<li><a href=":Category:clipboard">Clipboard Library</a></li>
 
</ul>
 
  
<p><br /><br />
+
clipboard.'''addText'''(text)
</p><a href="Category:clipboard">Clipboard Library</a>
+
 
 +
{| class="wikitable"
 +
|-
 +
! Parameter
 +
! Type
 +
! Description
 +
|-
 +
| <u><center>text</center></u>  
 +
| string
 +
| The text you want to add to the clipboard
 +
|}
 +
 
 +
== Example  ==
 +
 
 +
<source lang="lua">--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</source>  
 +
 
 +
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  ==
 +
*[[clipboard.getText|clipboard.getText]]
 +
 
 +
[[Category:clipboard]]

Latest revision as of 23:44, 30 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.

See also