module SF::Clipboard
Overview
Give access to the system clipboard
SF::Clipboard provides an interface for getting and
setting the contents of the system clipboard.
Usage example:
// get the clipboard content as a string
sf::String string = sf::Clipboard::getString();
// or use it in the event loop
sf::Event event;
while(window.pollEvent(event))
{
if(event.type == sf::Event::Closed)
window.close();
if(event.type == sf::Event::KeyPressed)
{
// Using Ctrl + V to paste a string into SFML
if(event.key.control && event.key.code == sf::Keyboard::V)
string = sf::Clipboard::getString();
}
}
// set the clipboard to a string
sf::Clipboard::setString("Hello World!");
See also: SF::String, SF::Event
Defined in:
window/obj.crClass Method Summary
-
.string : String
Get the content of the clipboard as string data
-
.string=(text : String)
Set the content of the clipboard as string data
Class Method Detail
def self.string : String
#
Get the content of the clipboard as string data
This function returns the content of the clipboard
as a string. If the clipboard does not contain string
it returns an empty SF::String object.
Returns: Clipboard contents as SF::String object
def self.string=(text : String)
#
Set the content of the clipboard as string data
This function sets the content of the clipboard as a string.
- text -
SF::Stringcontaining the data to be sent to the clipboard