Copy and paste

BlitzMax Forums/MaxGUI Module/Copy and paste

Czar Flavius(Posted 2010) [#1]
Is it possible to use copy and paste with text fields?


SebHoll(Posted 2010) [#2]
Is it possible to use copy and paste with text fields?

The code is certainly in there for MaxGUI.Win32MaxGUIEx. Can't remember with the other platforms, but there's an easy way to find out.

Check out the GadgetCopy(), GadgetCut() and GadgetPaste() commands (and possibly ActivateGadget() which will highlight the text-field text upon activation).


Czar Flavius(Posted 2010) [#3]
Could you give a code example?


ima747(Posted 2010) [#4]
GadgetCut/Copy/Paste works on mac, using it in my current project... interesting bug I forgot to report, cut/copy/paste are handled automatically on windows, but not mac. So when I wrote my edit menu handler to work on mac and compiled for windows and would then paste into a field it would paste twice


Czar Flavius(Posted 2010) [#5]
I really don't understand this. Could somebody please post a simple example of a window with 1 text field that I can copy and paste into? Thanks!


Ghost Dancer(Posted 2010) [#6]
You only really need this functions if you are doing something out of the ordinary, Ctrl+X/C/V works as standard so no extra coding is needed.


Czar Flavius(Posted 2010) [#7]
But it doesn't work! Tested on two Win 7 computers.


Ghost Dancer(Posted 2010) [#8]
Not tried it on Win 7 but it works fine on XP. Make you you haven't assigned those keys to another gadget/event.


Czar Flavius(Posted 2010) [#9]
I have now tested it on three Win 7 computers, and the other two aren't mine but friends, so it seems there's a bug!


rs22(Posted 2010) [#10]
I just tried on Windows 7. GadgetPaste() works fine, GadgetCopy() and GadgetCut() did not work.


SebHoll(Posted 2010) [#11]
Seems to work fine on Windows 7 x86 here. A tweaked CreateTextField() example (the one from the docs) seems to work as expected with GadgetCut(), GadgetCopy() and GadgetPaste(). Can you post a runnable code example, and maybe post it to MaxGUI bug reports if you still believe it to be a bug in the MaxGUI library?


rs22(Posted 2010) [#12]
Okay, it does work for me on Windows 7. My apologies!

The problem was, I had setup GadgetCut() and GadgetCopy() to work when a button was clicked. When the button was clicked, the text in the textfield was being deselected, so the cut or copy operation was never going to happen. Putting ActivateGadget() before GadgetCut() and GadgetCopy() solved the problem.

Here's a working example to demonstrate using the cut, copy and paste commands:



SebHoll, do you think we'll ever see clipboard image support in MaxGUI? Like, getting an image from the clipboard into a pixmap, and vice-versa? That would be amazing.


SebHoll(Posted 2010) [#13]
Okay, it does work for me on Windows 7. My apologies!

Glad that you managed to get it working. :-)

SebHoll, do you think we'll ever see clipboard image support in MaxGUI? Like, getting an image from the clipboard into a pixmap, and vice-versa? That would be amazing.

It's possible but I, personally, have no plans to implement this soon. Work is kinda crazy at the moment. Also although Win32 and Cocoa implementations might be OK, I'd have no idea where to start with Linux.


Czar Flavius(Posted 2010) [#14]
OK I've fixed the problem! I just imported everything as it never tells you what you need to import, including fltkmaxgui. Not including this lets copy and paste work again. I was wondering why it looked Linux-like.


Ghost Dancer(Posted 2010) [#15]
Download the Framework Assistant, it will tell you what you need to import :)