How to get Clipboard for desktop platforms?

175 views
Skip to first unread message

Creative Magic

unread,
Jun 29, 2016, 5:46:28 AM6/29/16
to Haxe
I'm looking for a way to easily use the clipboard of Windows and OS X platforms. So far I could only see one haxelib called "systools" that can get/set String data, but not binary data ( so you can't get files you've copied ).
As much as I could see I cannot access the Clipboard from the Haxe API unless it's a JS or Flash platform.

So far I've found one one way to deal with it: access Terminal (os x) or command line (windows) from haxe and try to get/set clipboard data that way. While it does work, the way of getting the clipboard data changes between versions of OS so I'm wondering - what's the best way of getting the Clipboard data in Haxe?

Justin L Mills

unread,
Jun 29, 2016, 6:16:37 AM6/29/16
to haxe...@googlegroups.com
Looks like Java swing/awt may not be hard.
http://java-demos.blogspot.co.uk/2012/11/get-data-from-clipboard-in-java.html

For windows and OSX you need to use SDL clipboard support, general approach in c++ here
http://lazyfoo.net/tutorials/SDL/32_text_input_and_clipboard_handling/index.php

More specifically I can see clipboard here.
https://github.com/nmehost/nme-state/blob/master/include/SDL2/SDL_clipboard.h

So I presume you can get it using either NME or NME and waxe, also possibly with Openfl.

If you want to use Snowkit/Luxe or other haxe c++ there is also some SDL linc support here:
http://snowkit.org/2015/08/24/announcing-linc/

So perhaps try adding this to your hxml and then look at the lazy foo for clues.
-lib linc_sdl

Would be interested what you find out.
--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages