Canvas widgets: Difference between revisions

Jump to navigation Jump to search
1,082 bytes removed ,  5 August 2012
m
Line 190: Line 190:
* f_getClipboardText() {{Done}}
* f_getClipboardText() {{Done}}


==== Nasal API ====
Usage examples can be found at [[Howto:Clipboard access using Nasal]].
In Nasal space, there exists a "clipboard" hash which can be used to access the clipboard. There are two types of clipboards supported:
 
* CLIPBOARD: Standard clipboard like on almost everything operating system
* SELECTION: Primary X Selection like found on X11 based systems. On non-X11 platform this clipboard is only accessible from inside FlightGear.
 
<syntaxhighlight lang="php">
# Setting/getting the contents of the given type of clipboard. If
# no type is specified it defaults to the standard clipboard.
# The return value indicates whether the operation completed
# successfully.
clipboard.setText: func(text, type = clipboard.CLIPBOARD) : bool
clipboard.getText: func(type = clipboard.CLIPBOARD)      : bool
</syntaxhighlight>
 
Some examples of using the clipboard:
 
<syntaxhighlight lang="php">
print("Clipboard contains: ", clipboard.getText() );
print("Selection contains: ", clipboard.getText(clipboard.SELECTION) );
 
if( !clipboard.setText("test") )
  print("Failed to write to clipboard");
if( !clipboard.setText("test-selection", clipboard.SELECTION) )
  print("Failed to write to selection");
</syntaxhighlight>


=== Reimplementing CanvasWindow without PUI dependency using osgGA (in progress) {{Pending}} ===
=== Reimplementing CanvasWindow without PUI dependency using osgGA (in progress) {{Pending}} ===

Navigation menu