Hi fellow wiki editors!

To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

I have tried to keep the template short, but meaningful. /Johan G

Howto:Clipboard access using Nasal

From FlightGear wiki
Jump to: navigation, search
This article is a stub. You can help the wiki by expanding it.

As of 08/2012 (i.e. in upcoming FlightGear 3.0), there's a "clipboard" hash in Nasal space 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.
# 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

Some examples of using the clipboard:

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");