Nasal library/clipboard: Difference between revisions

Doc setText()
m (→‎getText(): Source)
(Doc setText())
 
Line 20: Line 20:


=== setText() ===
=== setText() ===
{{Nasal doc
|syntax = clipboard.setText(text[, type]);
|source = {{flightgear source|src/Scripting/NasalClipboard.cxx|l=54|t=Source}}
|text = Sets the contents of the clipboard. If the operation is successful, 1 (true) is returned, otherwise 0 (false) is returned.
|param1 = text
|param1text = A string that will be put into the clipboard.
|param2 = type
|param2text = Optional argument that specifies into which part of the clipboard the text should be put. If <code>clipboard.CLIPBOARD</code> (the default) is given, it will go to the normal clipboard. If <code>clipboard.SELECTION</code> is given, the text will be added to the selection buffer. Note that only X11 systems properly implement <code>clipboard.SELECTION</code>, but this argument may still be used with <code>[[#setText()|setText()]]</code> (see example 2).
|example1 = clipboard.setText("Demo");
print("'", clipboard.getText(), "'"); # prints 'Demo'
|example2 = clipboard.setText("Demo", clipboard.SELECTION);
print("'", clipboard.getText(clipboard.SELECTION), "'"); # prints 'Demo'
}}


== Constants ==
== Constants ==