# copy/paste crossplatform

This topic is 502 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi

I only need the user to paste a number. How to open cross platform a gui for only doing that in the easiest possible way?

Thanks

##### Share on other sites

You will probably resort to using a toolkit (wxWidgets, Qt, GTK, etc.) for that, since "simply pasting a number in a GUI" is not at all a trivial task, let alone if it has to work cross-platform. Some platforms do not even have any such thing as "GUI" (other than being able to show a naked window) as part of the operating system at all. The toolkit basically is the "GUI" on those platforms.

Unluckily, toolkits are usually huge, ugly beasts which also do a million things that you don't need. But alas, that's something one has to swallow.

Note that "paste" (literally, in a sense of "from the clipboard") is quite possibly another thing than "enter" (although most decent GUIs should make that transparent for you in an edit field).

Edited by samoth

##### Share on other sites

Thanks I'll have a look at AntTweakBar.

##### Share on other sites

Hmm OK, but... this is kinda the opposite of what you asked for. AntTweakBar provides a nice, easy to use GUI, that's true.

However, you need to call TwKeyPressed every time the user hits a key to let AntTweakBar know that this happened. Which means you must do all the non-portable, system-dependent stuff like running an event loop listening to Windows key down messages. Though you might use something like e.g. SDL on top, which would abstract that. SDL also has functions to access the clipboard (though I've never used them, so can't say much about them).

Edited by samoth

##### Share on other sites

In my X-Plane plugin, I probably can't do a SDL_init_video. Easiest would be a simple OpenGL solution. QT looks like a lot of overhead for my purpose.

##### Share on other sites

In my X-Plane plugin

That is an important piece of information. Writing an X-Plane plugin is not at all the same as writing a game or an application. You neither own the application window, nor do you get the events, nor can you redirect them without totally screwing up the game, etc etc.

You will want to consult the X-Plane Plugin SDK for details. You will want to create a window (specifically a phase window) using the X-Plance SDK with a widget in it, and give it input focus when it needs to receive input. Alternatively, registering and unregistering a key sniffer might do the trick (if no visible feedback is needed). Edited by samoth

##### Share on other sites

I think you need to be a little more specific about what you need to do to get a good answer.

That is,

1. You want to "paste a number" from where to where e.g. from the clipboard to an existing native window that you don't control?

2. Which platforms do you need to support?

3. If all you need to do is paste why are you asking about "open[ing]" a GUI?

So I'm not sure how to answer, but if all you need to do is paste from the clipboard in any case I find it hard to believe there is going to be an easier way then implementing such functionality yourself on the platforms you want to support and abstracting the separate implementations in some platform-independent wrapper (the details of which will depend on the language(s) involved).

##### Share on other sites

Yes, funny that I didn't think about the obvious x-plane sdk widgets.

Thanks

##### Share on other sites

xplane sdk widgets doesn't provide copy/paste on all os, hence I try:

I want to use only the clipboard on win/mac/linux.
http://docs.wxwidgets.org/trunk/classwx_clipboard.html
But after including the header and sample code I get:

home/michael/Downloads/wxWidgets-3.0.2/include/wx/defs.h:46:13: error: #error "No Target! You should use wx-config program for compilation flags!"
Ubuntu/Eclipse
What to do? Thanks

--------
michael@michael-ubuntu:~/Downloads/wxWidgets-3.0.2$./wx-config --list Default config is gtk2-unicode-3.0 Default config in /home/michael/Downloads/wxWidgets-3.0.2 will be used for output michael@michael-ubuntu:~/Downloads/wxWidgets-3.0.2$ wx-config --cxxflags
The program 'wx-config' can be found in the following packages:
* libwxbase3.0-dev
* libwxgtk3.0-dev
Try: sudo apt install <selected package>
michael@michael-ubuntu:~/Downloads/wxWidgets-3.0.2$./wx-config --libs -L/home/michael/Downloads/wxWidgets-3.0.2/lib -pthread -Wl,-rpath,/home/michael/Downloads/wxWidgets-3.0.2/lib -lwx_gtk2u_xrc-3.0 -lwx_gtk2u_html-3.0 -lwx_gtk2u_qa-3.0 -lwx_gtk2u_adv-3.0 -lwx_gtk2u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0 michael@michael-ubuntu:~/Downloads/wxWidgets-3.0.2$ ./wx-config --cxxflags

Edited by mike44

1. 1
Rutin
24
2. 2
3. 3
JoeJ
20
4. 4
5. 5

• 9
• 46
• 41
• 23
• 13
• ### Forum Statistics

• Total Topics
631746
• Total Posts
3002022
×